From d7eea4a0e00a103a9117ae247aee3c5015877797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 29 Jun 2021 14:35:07 +0200 Subject: [PATCH] customize repos path with ANSIBLE_REPOS_PATH env var MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- github/update_ansible.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/github/update_ansible.py b/github/update_ansible.py index 701c901..5cb73fd 100755 --- a/github/update_ansible.py +++ b/github/update_ansible.py @@ -1,10 +1,12 @@ #!/usr/bin/env python3 # I could use yaml module, but it fucks ups the order and formatting. import re +from os import getenv from os.path import isdir, expanduser from subprocess import check_output path = 'ansible/requirements.yml' +repos_path = getenv('ANSIBLE_REPOS_PATH', '~/work') with open(path, 'r') as f: contents = f.readlines() @@ -48,7 +50,7 @@ for line in lines: # Read commits from repos for entry in entries: - cwd = expanduser('~/work/%s' % entry['full_name']) + cwd = expanduser('%s/%s' % (repos_path, entry['full_name'])) if not isdir(cwd): print('No such repo: %s' % cwd) continue