diff options
author | Darius Makovsky <traveltissues@protonmail.com> | 2019-12-02 16:24:03 +0000 |
---|---|---|
committer | Darius Makovsky <traveltissues@protonmail.com> | 2019-12-02 16:24:03 +0000 |
commit | 338eb3c32f32cc20612b8b5ab5da292f3867f316 (patch) | |
tree | bddf2185c7b61078166d79d8ab8782b7aec242b7 | |
parent | 05aaf3eadff2981fe3c16e6c3a808c37f0ca1187 (diff) | |
download | buildstream-traveltissues/reviewsast1.tar.gz |
Address use of shelltraveltissues/reviewsast1
-rwxr-xr-x | contrib/update_committers.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/contrib/update_committers.py b/contrib/update_committers.py index 27dbc5abf..8f9bbefbc 100755 --- a/contrib/update_committers.py +++ b/contrib/update_committers.py @@ -49,7 +49,7 @@ def get_table_entry(entry: str) -> str: def find_repository_root() -> str: root = os.getcwd() try: - root = subprocess.check_output('git rev-parse --show-toplevel', shell=True) + root = subprocess.check_output(['git', 'rev-parse', '--show-toplevel']) except CalledProcessError as e: print('The current working directory is not a git repository. \ \"git rev-parse --show-toplevel\" exited with code {}.'.format(e.returncode)) @@ -71,16 +71,15 @@ def create_committers_file(committers: OrderedDict): def commit_changes_if_needed(token: str): - committers_file = os.path.join(find_repository_root(), 'COMMITTERS.rst') - git_diff = subprocess.call('git diff --quiet {}'.format(committers_file), shell=True) + committers_file = str(os.path.join(find_repository_root(), 'COMMITTERS.rst')) + git_diff = subprocess.run(['git', 'diff' ,'--quiet', committers_file]) if git_diff: commit_message = '\'Update COMMITTERS.rst\'' branch_name = 'update_committers' - subprocess.call('git add {}'.format(committers_file), shell=True) - subprocess.call('git commit -m {}'.format(commit_message), shell=True) + subprocess.run(['git', 'add', committers_file]) + subprocess.run(['git', 'commit', '-m', commit_message]) try: - subprocess.call('git push -u origin {} 2>&1'.format(branch_name), - shell=True) + subprocess.run(['git', 'push', '-u', 'origin', branch_name], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) except CalledProcessError as e: print('Could not push to remote branch. \"git push -u origin {}\" \ exited with code {}.'.format(branch_name, e.returncode)) |