From db706465e4216e58038096e62c7f592204645605 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Wed, 1 Sep 2021 16:18:48 -0400 Subject: [PATCH 1/6] ci: build / test wheels for Python 3.10 [WIP] (#78) Closes #49. --- .github/workflows/presubmit.yml | 15 ++++++++------- .github/workflows/python-publish.yml | 6 +++--- scripts/manylinux/build_on_centos.sh | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 675f37f4..351e3135 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -27,7 +27,11 @@ jobs: # 3.10 is not yet available in manylinux docker images. # https://github.com/pypa/manylinux # python: [3.6, 3.7, 3.8, 3.9, 3.10-dev] - python: [3.6, 3.7, 3.8, 3.9] + python: [3.6, 3.7, 3.8, 3.9, 3.10-dev] + # It is possible 3.10-dev will fail when the other versions are green. + # Turn off fast fail so if 3.10 fails the other required versions have + # the opportunity to pass. + fail-fast: false steps: - uses: actions/checkout@v2 - name: Set up Python @@ -36,8 +40,7 @@ jobs: python-version: ${{ matrix.python }} - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install setuptools wheel + python -m pip install --upgrade setuptools pip wheel - name: Build env: BUILD_PYTHON: ${{ matrix.python }} @@ -73,8 +76,7 @@ jobs: python-version: ${{ matrix.python }} - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install setuptools wheel + python -m pip install --upgrade setuptools pip wheel - name: Build run: | ./scripts/osx/build_gh_action.sh @@ -113,8 +115,7 @@ jobs: python-version: ${{ matrix.python }} - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install setuptools wheel + python -m pip install --upgrade setuptools pip wheel - name: Build run: | where python diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 3620ee78..9370d202 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: [3.6, 3.7, 3.8, 3.9] + python: [3.6, 3.7, 3.8, 3.9, 3.10dev] steps: - uses: actions/checkout@v2 - name: Set up Python @@ -56,7 +56,7 @@ jobs: runs-on: macos-latest strategy: matrix: - python: [3.6, 3.7, 3.8, 3.9] + python: [3.6, 3.7, 3.8, 3.9, 3.10dev] steps: - uses: actions/checkout@v2 - name: Set up Python @@ -87,7 +87,7 @@ jobs: runs-on: windows-latest strategy: matrix: - python: [3.6, 3.7, 3.8, 3.9] + python: [3.6, 3.7, 3.8, 3.9, 3.10dev] steps: - uses: actions/checkout@v2 - name: Add msbuild to PATH diff --git a/scripts/manylinux/build_on_centos.sh b/scripts/manylinux/build_on_centos.sh index 8515e46a..efc027f6 100755 --- a/scripts/manylinux/build_on_centos.sh +++ b/scripts/manylinux/build_on_centos.sh @@ -66,7 +66,7 @@ if [[ -z ${BUILD_PYTHON} ]]; then fi done else - STRIPPED_PYTHON=$(echo ${BUILD_PYTHON} | sed -e "s/\.//g") + STRIPPED_PYTHON=$(echo ${BUILD_PYTHON} | sed -e "s/\.//g" | sed -e "s/-dev$//") for PYTHON_BIN in /opt/python/*/bin; do if [[ "${PYTHON_BIN}" == *"${STRIPPED_PYTHON}"* ]]; then PYTHON_VERSIONS="${PYTHON_VERSIONS} ${PYTHON_BIN}" From 6aa1cd69376b57fbc9bc2c470ed63a270279623d Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Wed, 1 Sep 2021 16:28:21 -0400 Subject: [PATCH 2/6] fix: advise setting 'CRC32C_PURE_PYTHON' after build failure (#84) Set 'CRC32C_PURE_PYTHON=0' during CI. Toward #83. --- .github/workflows/presubmit.yml | 5 ++++ .github/workflows/python-publish.yml | 5 ++++ setup.py | 41 ++++++++++++++++++++-------- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 351e3135..0f1b460e 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -44,6 +44,7 @@ jobs: - name: Build env: BUILD_PYTHON: ${{ matrix.python }} + CRC32C_PURE_PYTHON: "0" run: | ./scripts/manylinux/build.sh - name: Test Import @@ -78,6 +79,8 @@ jobs: run: | python -m pip install --upgrade setuptools pip wheel - name: Build + env: + CRC32C_PURE_PYTHON: "0" run: | ./scripts/osx/build_gh_action.sh - name: Test Import @@ -117,6 +120,8 @@ jobs: run: | python -m pip install --upgrade setuptools pip wheel - name: Build + env: + CRC32C_PURE_PYTHON: "0" run: | where python ./scripts/windows/build.bat ${{ matrix.python }} diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 9370d202..f11d5c8d 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -37,6 +37,7 @@ jobs: - name: Build env: BUILD_PYTHON: ${{ matrix.python }} + CRC32C_PURE_PYTHON: "0" run: | ./scripts/manylinux/build.sh - name: Test Import @@ -68,6 +69,8 @@ jobs: python -m pip install --upgrade pip pip install setuptools wheel - name: Build + env: + CRC32C_PURE_PYTHON: "0" run: | ./scripts/osx/build_gh_action.sh - name: Test Import @@ -104,6 +107,8 @@ jobs: python -m pip install --upgrade pip pip install setuptools wheel - name: Build + env: + CRC32C_PURE_PYTHON: "0" run: | where python ./scripts/windows/build.bat ${{ matrix.python }} diff --git a/setup.py b/setup.py index 3dc9a97a..0458e8d0 100644 --- a/setup.py +++ b/setup.py @@ -12,15 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +import logging import os import shutil import setuptools import setuptools.command.build_ext -import warnings _EXTRA_DLL = "extra-dll" _DLL_FILENAME = "crc32c.dll" -CRC32C_PURE_PYTHON = os.getenv("CRC32C_PURE_PYTHON") is not None + +# Explicit environment variable disables pure-Python fallback +CRC32C_PURE_PYTHON_EXPLICIT = "CRC32C_PURE_PYTHON" in os.environ +_FALSE_OPTIONS = ("0", "false", "no", "False", "No", None) +CRC32C_PURE_PYTHON = os.getenv("CRC32C_PURE_PYTHON") not in _FALSE_OPTIONS def copy_dll(build_lib): @@ -54,14 +58,27 @@ def run(self): if CRC32C_PURE_PYTHON: - ext_modules = [] + setuptools.setup( + packages=["google_crc32c"], + package_dir={"": "src"}, + ext_modules=[], + ) else: - ext_modules = [module] - - -setuptools.setup( - packages=["google_crc32c"], - package_dir={"": "src"}, - ext_modules=ext_modules, - cmdclass={"build_ext": BuildExtWithDLL}, -) + try: + setuptools.setup( + packages=["google_crc32c"], + package_dir={"": "src"}, + ext_modules=[module], + cmdclass={"build_ext": BuildExtWithDLL}, + ) + except SystemExit: + if "CRC32C_PURE_PYTHON" not in os.environ: + # If build / install fails, it is likely a compilation error with + # the C extension: advise user how to enable the pure-Python + # build. + logging.error( + "Compiling the C Extension for the crc32c library failed. " + "To enable building / installing a pure-Python-only version, " + "set 'CRC32C_PURE_PYTHON=1' in the environment." + ) + raise From ebb9c68aca66e6b89d832e9e237679ac8b9ad344 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Wed, 1 Sep 2021 17:09:58 -0400 Subject: [PATCH 3/6] fix: restore building 'manylinux1' wheels (#87) * ci: restore building 'manylinux1' wheels. Toward #83. * ci: skip 'manylinux1' build on CI for Python 3.10 That image does not support Python 3.10, nor will it ever. --- scripts/manylinux/build.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/manylinux/build.sh b/scripts/manylinux/build.sh index 8276a887..6dfb4582 100755 --- a/scripts/manylinux/build.sh +++ b/scripts/manylinux/build.sh @@ -21,12 +21,25 @@ MANYLINUX_DIR=$(echo $(cd $(dirname ${0}); pwd)) SCRIPTS_DIR=$(dirname ${MANYLINUX_DIR}) REPO_ROOT=$(dirname ${SCRIPTS_DIR}) -docker pull quay.io/pypa/manylinux2010_x86_64 -docker pull quay.io/pypa/manylinux2014_x86_64 cd $REPO_ROOT git submodule update --init --recursive +# Note: PyPA's support for the 'manylinux1' image ends on 2022-01-01. +# See: https://github.com/pypa/manylinux/issues/994 +# No 3.10 support for 'manylinux1'. +if [[ "${BUILD_PYTHON}" != "3.10"* ]]; then + docker pull quay.io/pypa/manylinux1_x86_64 + docker run \ + --rm \ + --interactive \ + --volume ${REPO_ROOT}:/var/code/python-crc32c/ \ + --env BUILD_PYTHON=${BUILD_PYTHON} \ + quay.io/pypa/manylinux1_x86_64 \ + /var/code/python-crc32c/scripts/manylinux/build_on_centos.sh +fi + +docker pull quay.io/pypa/manylinux2010_x86_64 docker run \ --rm \ --interactive \ @@ -35,6 +48,7 @@ docker run \ quay.io/pypa/manylinux2010_x86_64 \ /var/code/python-crc32c/scripts/manylinux/build_on_centos.sh +docker pull quay.io/pypa/manylinux2014_x86_64 docker run \ --rm \ --interactive \ @@ -44,6 +58,7 @@ docker run \ /var/code/python-crc32c/scripts/manylinux/build_on_centos.sh docker run --rm --privileged hypriot/qemu-register +docker pull quay.io/pypa/manylinux2014_aarch64 docker run \ --rm \ --interactive \ From a548997369cd8954cff177244d891c1d53480c41 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 1 Sep 2021 17:18:59 -0400 Subject: [PATCH 4/6] chore: release 1.1.4 (#86) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 ++++++++ setup.cfg | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c845a96d..604968a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ [1]: https://pypi.org/project/google-crc32c/#history +### [1.1.4](https://www.github.com/googleapis/python-crc32c/compare/v1.1.3...v1.1.4) (2021-09-01) + + +### Bug Fixes + +* advise setting 'CRC32C_PURE_PYTHON' after build failure ([#84](https://www.github.com/googleapis/python-crc32c/issues/84)) ([6aa1cd6](https://www.github.com/googleapis/python-crc32c/commit/6aa1cd69376b57fbc9bc2c470ed63a270279623d)) +* restore building 'manylinux1' wheels ([#87](https://www.github.com/googleapis/python-crc32c/issues/87)) ([ebb9c68](https://www.github.com/googleapis/python-crc32c/commit/ebb9c68aca66e6b89d832e9e237679ac8b9ad344)) + ### [1.1.3](https://www.github.com/googleapis/python-crc32c/compare/v1.1.2...v1.1.3) (2021-08-30) diff --git a/setup.cfg b/setup.cfg index cb8358ef..3be11080 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,7 +14,7 @@ [metadata] name = google-crc32c -version = 1.1.3 +version = 1.1.4 description = A python wrapper of the C library 'Google CRC32C' url = https://github.com/googleapis/python-crc32c long_description = file: README.md From 0c1b740c195caed8ac1e67fc38d87073223a6b3d Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Thu, 2 Sep 2021 12:21:17 -0400 Subject: [PATCH 5/6] fix: use correct Python 3.10 specifier (#88) Update documented released platforms / architectures / wheels. Closes #81. Release-As: 1.1.4 --- .github/workflows/python-publish.yml | 6 +-- README.md | 66 +++++++++++++++++----------- 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index f11d5c8d..33e4c8f3 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: [3.6, 3.7, 3.8, 3.9, 3.10dev] + python: [3.6, 3.7, 3.8, 3.9, 3.10-dev] steps: - uses: actions/checkout@v2 - name: Set up Python @@ -57,7 +57,7 @@ jobs: runs-on: macos-latest strategy: matrix: - python: [3.6, 3.7, 3.8, 3.9, 3.10dev] + python: [3.6, 3.7, 3.8, 3.9, 3.10-dev] steps: - uses: actions/checkout@v2 - name: Set up Python @@ -90,7 +90,7 @@ jobs: runs-on: windows-latest strategy: matrix: - python: [3.6, 3.7, 3.8, 3.9, 3.10dev] + python: [3.6, 3.7, 3.8, 3.9, 3.10-dev] steps: - uses: actions/checkout@v2 - name: Add msbuild to PATH diff --git a/README.md b/README.md index e2daa49e..6f1563f4 100644 --- a/README.md +++ b/README.md @@ -13,41 +13,55 @@ Wheels are currently published for Python 3.6, 3.7, 3.8, 3.9 for multiple architectures. For information on building your own, please view [BUILDING.md](BUILDING.md). ## Linux -Wheels are published for `manylinux1`, `manylinux2010`, `manylinux2014` for -`x86_64`, `aarch64` architectures. +Wheels are published for the following platforms / architectures: -- google_crc32c-1.1.1-cp36-cp36m-manylinux1_x86_64.whl -- google_crc32c-1.1.1-cp37-cp37m-manylinux1_x86_64.whl -- google_crc32c-1.1.1-cp38-cp38-manylinux1_x86_64.whl -- google_crc32c-1.1.1-cp39-cp39-manylinux1_x86_64.whl +### `manylinux1` platform, `x86_64` architecture +- `google_crc32c-1.1.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl` +- `google_crc32c-1.1.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl` +- `google_crc32c-1.1.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl` +- `google_crc32c-1.1.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl` -- google_crc32c-1.1.1-cp36-cp36m-manylinux2010_x86_64.whl -- google_crc32c-1.1.1-cp37-cp37m-manylinux2010_x86_64.whl -- google_crc32c-1.1.1-cp38-cp38-manylinux2010_x86_64.whl -- google_crc32c-1.1.1-cp39-cp39-manylinux2010_x86_64.whl +### `manylinux2010` platform, `x86_64` architecture +- `google_crc32c-1.1.4-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl` +- `google_crc32c-1.1.4-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl` +- `google_crc32c-1.1.4-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl` +- `google_crc32c-1.1.4-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl` +- `google_crc32c-1.1.4-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl` -- google_crc32c-1.1.1-cp36-cp36-manylinux2014_aarch64.whl -- google_crc32c-1.1.1-cp37-cp37-manylinux2014_aarch64.whl -- google_crc32c-1.1.1-cp38-cp38-manylinux2014_aarch64.whl -- google_crc32c-1.1.1-cp39-cp39-manylinux2014_aarch64.whl +### `manylinux2014` platform, `x86_64` architecture +- `google_crc32c-1.1.4-cp36-cp36-manylinux_2_17_x86_64.manylinux2014_x86_64.whl` +- `google_crc32c-1.1.4-cp37-cp37-manylinux_2_17_x86_64.manylinux2014_x86_64.whl` +- `google_crc32c-1.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl` +- `google_crc32c-1.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl` +- `google_crc32c-1.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl` + +### `manylinux2014` platform, `aarch64` architecture +- `google_crc32c-1.1.4-cp36-cp36-manylinux_2_17_aarch64.manylinux2014_aarch64.whl` +- `google_crc32c-1.1.4-cp37-cp37-manylinux_2_17_aarch64.manylinux2014_aarch64.whl` +- `google_crc32c-1.1.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl` +- `google_crc32c-1.1.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl` +- `google_crc32c-1.1.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl` ## Mac OS Wheels are published for `x86_64` architectures -- google_crc32c-1.1.1-cp36-cp36m-macosx_10_14_x86_64.whl -- google_crc32c-1.1.1-cp37-cp37m-macosx_10_14_x86_64.whl -- google_crc32c-1.1.1-cp38-cp38-macosx_10_14_x86_64.whl -- google_crc32c-1.1.1-cp39-cp39-macosx_10_14_x86_64.whl +- `google_crc32c-1.1.4-cp36-cp36m-macosx_10_14_x86_64.whl` +- `google_crc32c-1.1.4-cp37-cp37m-macosx_10_14_x86_64.whl` +- `google_crc32c-1.1.4-cp38-cp38-macosx_10_14_x86_64.whl` +- `google_crc32c-1.1.4-cp39-cp39-macosx_10_14_x86_64.whl` +- `google_crc32c-1.1.4-cp310-cp310-macosx_10_14_x86_64.whl` ## Windows Wheels are published for `win32` and `win_amd64` architectures. -- google_crc32c-1.1.1-cp36-cp36m-win32.whl -- google_crc32c-1.1.1-cp37-cp37m-win32.whl -- google_crc32c-1.1.1-cp38-cp38-win32.whl -- google_crc32c-1.1.1-cp39-cp39-win32.whl +- `google_crc32c-1.1.4-cp36-cp36m-win32.whl` +- `google_crc32c-1.1.4-cp37-cp37m-win32.whl` +- `google_crc32c-1.1.4-cp38-cp38-win32.whl` +- `google_crc32c-1.1.4-cp39-cp39-win32.whl` +- `google_crc32c-1.1.4-cp310-cp310-win32.whl` -- google_crc32c-1.1.1-cp36-cp36m-win_amd64.whl -- google_crc32c-1.1.1-cp37-cp37m-win_amd64.whl -- google_crc32c-1.1.1-cp38-cp38-win_amd64.whl -- google_crc32c-1.1.1-cp39-cp39-win_amd64.whl +- `google_crc32c-1.1.4-cp36-cp36m-win_amd64.whl` +- `google_crc32c-1.1.4-cp37-cp37m-win_amd64.whl` +- `google_crc32c-1.1.4-cp38-cp38-win_amd64.whl` +- `google_crc32c-1.1.4-cp39-cp39-win_amd64.whl` +- `google_crc32c-1.1.4-cp310-cp310-win_amd64.whl` From 96f8132a1aaa191e88d5018ba2d9633c4f63b284 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 2 Sep 2021 12:39:38 -0400 Subject: [PATCH 6/6] chore: release 1.1.4 (#90) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Tres Seaver --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 604968a8..a644191c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ [1]: https://pypi.org/project/google-crc32c/#history +### [1.1.4](https://www.github.com/googleapis/python-crc32c/compare/v1.1.4...v1.1.4) (2021-09-02) + + +### Bug Fixes + +* advise setting 'CRC32C_PURE_PYTHON' after build failure ([#84](https://www.github.com/googleapis/python-crc32c/issues/84)) ([6aa1cd6](https://www.github.com/googleapis/python-crc32c/commit/6aa1cd69376b57fbc9bc2c470ed63a270279623d)) +* restore building 'manylinux1' wheels ([#87](https://www.github.com/googleapis/python-crc32c/issues/87)) ([ebb9c68](https://www.github.com/googleapis/python-crc32c/commit/ebb9c68aca66e6b89d832e9e237679ac8b9ad344)) +* use correct Python 3.10 specifier ([#88](https://www.github.com/googleapis/python-crc32c/issues/88)) ([0c1b740](https://www.github.com/googleapis/python-crc32c/commit/0c1b740c195caed8ac1e67fc38d87073223a6b3d)) + ### [1.1.4](https://www.github.com/googleapis/python-crc32c/compare/v1.1.3...v1.1.4) (2021-09-01)