48 lines
1.4 KiB
Plaintext
48 lines
1.4 KiB
Plaintext
|
#!/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()
|