Skip to content

Commit 7cad0be

Browse files
authored
Fail the CI if an optional module fails to compile (GH-27466)
1 parent f4367ba commit 7cad0be

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ jobs:
119119
runs-on: macos-latest
120120
needs: check_source
121121
if: needs.check_source.outputs.run_tests == 'true'
122+
env:
123+
PYTHONSTRICTEXTENSIONBUILD: 1
122124
steps:
123125
- uses: actions/checkout@v2
124126
- name: Configure CPython
@@ -137,6 +139,7 @@ jobs:
137139
if: needs.check_source.outputs.run_tests == 'true'
138140
env:
139141
OPENSSL_VER: 1.1.1k
142+
PYTHONSTRICTEXTENSIONBUILD: 1
140143
steps:
141144
- uses: actions/checkout@v2
142145
- name: Register gcc problem matcher
@@ -227,6 +230,7 @@ jobs:
227230
if: needs.check_source.outputs.run_tests == 'true'
228231
env:
229232
OPENSSL_VER: 1.1.1k
233+
PYTHONSTRICTEXTENSIONBUILD: 1
230234
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
231235
steps:
232236
- uses: actions/checkout@v2

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ env:
1818
# Set rpath with env var instead of -Wl,-rpath linker flag
1919
# OpenSSL ignores LDFLAGS when linking bin/openssl
2020
- LD_RUN_PATH="${OPENSSL_DIR}/lib"
21+
- PYTHONSTRICTEXTENSIONBUILD=1
2122

2223
branches:
2324
only:

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,9 @@ def print_three_column(lst):
571571
print("Custom linker flags may require --with-openssl-rpath=auto")
572572
print()
573573

574+
if os.environ.get("PYTHONSTRICTEXTENSIONBUILD") and (self.failed or self.failed_on_import):
575+
raise RuntimeError("Failed to build some stdlib modules")
576+
574577
def build_extension(self, ext):
575578

576579
if ext.name == '_ctypes':

0 commit comments

Comments
 (0)