[Python-checkins] CI: Fix patchcheck (GH-31708)

asvetlov webhook-mailer at python.org
Mon Mar 14 09:29:25 EDT 2022


https://github.com/python/cpython/commit/23abae621f579014eb29d5c6621f031c8a1a4057
commit: 23abae621f579014eb29d5c6621f031c8a1a4057
branch: main
author: Hugo van Kemenade <hugovk at users.noreply.github.com>
committer: asvetlov <andrew.svetlov at gmail.com>
date: 2022-03-14T15:28:57+02:00
summary:

CI: Fix patchcheck (GH-31708)

files:
M .azure-pipelines/posix-steps.yml
M Tools/scripts/patchcheck.py

diff --git a/.azure-pipelines/posix-steps.yml b/.azure-pipelines/posix-steps.yml
index 2a3680897302e..29b43e0934472 100644
--- a/.azure-pipelines/posix-steps.yml
+++ b/.azure-pipelines/posix-steps.yml
@@ -66,7 +66,9 @@ steps:
         COMMAND: make
 
 - ${{ if eq(parameters.patchcheck, 'true') }}:
-  - script: ./python Tools/scripts/patchcheck.py --ci true
+  - script: |
+      git fetch origin
+      ./python Tools/scripts/patchcheck.py --ci true
     displayName: 'Run patchcheck.py'
     condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
 
diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py
index 4cab66c8e97be..a324eafc52b2a 100755
--- a/Tools/scripts/patchcheck.py
+++ b/Tools/scripts/patchcheck.py
@@ -130,6 +130,8 @@ def changed_files(base_branch=None):
         with subprocess.Popen(cmd.split(),
                               stdout=subprocess.PIPE,
                               cwd=SRCDIR) as st:
+            if st.wait() != 0:
+                sys.exit(f'error running {cmd}')
             for line in st.stdout:
                 line = line.decode().rstrip()
                 status_text, filename = line.split(maxsplit=1)



More information about the Python-checkins mailing list