customize repos path with ANSIBLE_REPOS_PATH env var

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-06-29 14:35:07 +02:00
parent e2acd95f62
commit d7eea4a0e0
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 3 additions and 1 deletions

View File

@ -1,10 +1,12 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# I could use yaml module, but it fucks ups the order and formatting. # I could use yaml module, but it fucks ups the order and formatting.
import re import re
from os import getenv
from os.path import isdir, expanduser from os.path import isdir, expanduser
from subprocess import check_output from subprocess import check_output
path = 'ansible/requirements.yml' path = 'ansible/requirements.yml'
repos_path = getenv('ANSIBLE_REPOS_PATH', '~/work')
with open(path, 'r') as f: with open(path, 'r') as f:
contents = f.readlines() contents = f.readlines()
@ -48,7 +50,7 @@ for line in lines:
# Read commits from repos # Read commits from repos
for entry in entries: for entry in entries:
cwd = expanduser('~/work/%s' % entry['full_name']) cwd = expanduser('%s/%s' % (repos_path, entry['full_name']))
if not isdir(cwd): if not isdir(cwd):
print('No such repo: %s' % cwd) print('No such repo: %s' % cwd)
continue continue