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:
parent
135feda117
commit
3151881de3
|
@ -1,3 +1,4 @@
|
||||||
*.pyc
|
*.pyc
|
||||||
*.egg-info
|
*.egg-info
|
||||||
git_stats
|
git_stats
|
||||||
|
repos
|
||||||
|
|
|
@ -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()
|
Loading…
Reference in New Issue