/usr/share/pyshared/cookiecutter/vcs.py is in python-cookiecutter 0.6.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.vcs
----------------
Helper functions for working with version control systems.
"""
import logging
import os
import shutil
import sys
from .prompt import query_yes_no
def git_clone(repo):
"""
Clone a git repo to the current directory.
:param repo: Git repo URL ending with .git.
"""
# Return repo dir
tail = os.path.split(repo)[1]
repo_dir = tail.rsplit('.git')[0]
logging.debug('repo_dir is {0}'.format(repo_dir))
if os.path.isdir(repo_dir):
ok_to_delete = query_yes_no("You've cloned {0} before. Is it okay to delete and re-clone it?".format(repo_dir))
if ok_to_delete:
shutil.rmtree(repo_dir)
else:
sys.exit()
os.system('git clone {0}'.format(repo))
return repo_dir
|