From 6cce79d40e5cd431510e9789e022949ed4fa790f Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Fri, 30 Jul 2021 15:21:09 +0100 Subject: [PATCH] [3.9] Fail the CI if an optional module fails to compile (GH-27466). (cherry picked from commit 7cad0bee80a536c7e47f54cf43174175834f30a0) Co-authored-by: Pablo Galindo Salgado --- .github/workflows/build.yml | 3 +++ .travis.yml | 1 + setup.py | 3 +++ 3 files changed, 7 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a4efb42f5aa064..3c0a41478e2ed1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -133,6 +133,8 @@ jobs: runs-on: macos-latest needs: check_source if: needs.check_source.outputs.run_tests == 'true' + env: + PYTHONSTRICTEXTENSIONBUILD: 1 steps: - uses: actions/checkout@v2 - name: Configure CPython @@ -151,6 +153,7 @@ jobs: if: needs.check_source.outputs.run_tests == 'true' env: OPENSSL_VER: 1.1.1k + PYTHONSTRICTEXTENSIONBUILD: 1 steps: - uses: actions/checkout@v2 - name: Install Dependencies diff --git a/.travis.yml b/.travis.yml index 02b2afa4816c77..171e4d053917eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ env: # Set rpath with env var instead of -Wl,-rpath linker flag # OpenSSL ignores LDFLAGS when linking bin/openssl - LD_RUN_PATH="${OPENSSL_DIR}/lib" + - PYTHONSTRICTEXTENSIONBUILD=1 branches: only: diff --git a/setup.py b/setup.py index 04eb6b291c7705..0789e178b744ca 100644 --- a/setup.py +++ b/setup.py @@ -540,6 +540,9 @@ def print_three_column(lst): "APIs, https://github.com/libressl-portable/portable/issues/381") print() + if os.environ.get("PYTHONSTRICTEXTENSIONBUILD") and (self.failed or self.failed_on_import): + raise RuntimeError("Failed to build some stdlib modules") + def build_extension(self, ext): if ext.name == '_ctypes':