diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-10-20 01:25:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-20 01:25:51 (GMT) |
commit | 42c52a9e45ed6ff2867403894bc030ed5780282d (patch) | |
tree | b281ee30a9dad1595b655c49f3f9a446c3c836fc /Tools/scripts/patchcheck.py | |
parent | d9a2665fc4573c4d311a89750737ad4cc3310252 (diff) | |
download | cpython-42c52a9e45ed6ff2867403894bc030ed5780282d.zip cpython-42c52a9e45ed6ff2867403894bc030ed5780282d.tar.gz cpython-42c52a9e45ed6ff2867403894bc030ed5780282d.tar.bz2 |
bpo-32256: Make patchcheck.py work for out-of-tree builds (GH-4760)
Set SRCDIR as the current directory for git.
(cherry picked from commit aa95bfb5fee366aa58c90b7e1c77fc7e183dbf3a)
Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
Diffstat (limited to 'Tools/scripts/patchcheck.py')
-rwxr-xr-x | Tools/scripts/patchcheck.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py index 4ab6b77..e5214ab 100755 --- a/Tools/scripts/patchcheck.py +++ b/Tools/scripts/patchcheck.py @@ -49,7 +49,9 @@ def get_git_branch(): """Get the symbolic name for the current git branch""" cmd = "git rev-parse --abbrev-ref HEAD".split() try: - return subprocess.check_output(cmd, stderr=subprocess.DEVNULL) + return subprocess.check_output(cmd, + stderr=subprocess.DEVNULL, + cwd=SRCDIR) except subprocess.CalledProcessError: return None @@ -61,7 +63,9 @@ def get_git_upstream_remote(): """ cmd = "git remote get-url upstream".split() try: - subprocess.check_output(cmd, stderr=subprocess.DEVNULL) + subprocess.check_output(cmd, + stderr=subprocess.DEVNULL, + cwd=SRCDIR) except subprocess.CalledProcessError: return "origin" return "upstream" @@ -99,7 +103,9 @@ def changed_files(base_branch=None): else: cmd = 'git status --porcelain' filenames = [] - with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as st: + with subprocess.Popen(cmd.split(), + stdout=subprocess.PIPE, + cwd=SRCDIR) as st: for line in st.stdout: line = line.decode().rstrip() status_text, filename = line.split(maxsplit=1) |