Keep local copy of repos for statistics work

Keeps me from having to mess with all my working areas all the time
This commit is contained in:
Eli Ribble 2015-07-30 17:25:21 -06:00
parent 135feda117
commit 3151881de3
2 changed files with 48 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.pyc
*.egg-info
git_stats
repos

47
bin/populate-repos Executable file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env python
import os
import subprocess
import teamanalysis.repos
def _clone_repo(target, source):
if os.path.exists(target):
print("Skipping checkout of {}".format(target))
return
command = [
'git',
'clone',
source,
target,
]
return subprocess.check_output(command)
def _create_virtualenv(target):
if os.path.exists(os.path.join(target, 've')):
print("Skipping virtualenv for {}".format(target))
return
os.chdir(target)
command = ['virtualenv', '-p', 'python3', 've']
subprocess.check_output(command)
print("Created virtualenv for {}".format(target))
def _install_dependencies(target):
os.chdir(target)
pip = os.path.join(target, 've', 'bin', 'pip')
command = [pip, 'install', '-e', '.[develop]']
subprocess.check_output(command)
def main():
target_root = '/Users/eliribble/src/teamanalysis/repos/'
for repo in teamanalysis.repos.REPOSITORIES:
target = os.path.join(target_root, repo)
source = 'git@bitbucket.org:Authentise/{}.git'.format(repo)
output = _clone_repo(target, source)
_create_virtualenv(target)
try:
_install_dependencies(target)
except subprocess.CalledProcessError as e:
print("Failed to install dependencies for {}: {}".format(target, e))
if __name__ == '__main__':
main()