summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorAlexey Izbyshev <izbyshev@ispras.ru>2018-10-20 00:49:41 (GMT)
committerVictor Stinner <vstinner@redhat.com>2018-10-20 00:49:41 (GMT)
commitaa95bfb5fee366aa58c90b7e1c77fc7e183dbf3a (patch)
tree06595f183cddb84835ccfedfcc821b4e427c08e4 /Tools
parentd5b4f1b5a064c0d858352100fcddb91c363afa51 (diff)
downloadcpython-aa95bfb5fee366aa58c90b7e1c77fc7e183dbf3a.zip
cpython-aa95bfb5fee366aa58c90b7e1c77fc7e183dbf3a.tar.gz
cpython-aa95bfb5fee366aa58c90b7e1c77fc7e183dbf3a.tar.bz2
bpo-32256: Make patchcheck.py work for out-of-tree builds (GH-4760)
Set SRCDIR as the current directory for git.
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/patchcheck.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py
index a1253d1..8a8480a 100755
--- a/Tools/scripts/patchcheck.py
+++ b/Tools/scripts/patchcheck.py
@@ -48,7 +48,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
@@ -60,7 +62,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"
@@ -98,7 +102,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)