diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 675f37f4..0f1b460e 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,11 +40,11 @@ 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 }} + CRC32C_PURE_PYTHON: "0" run: | ./scripts/manylinux/build.sh - name: Test Import @@ -73,9 +77,10 @@ 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: + CRC32C_PURE_PYTHON: "0" run: | ./scripts/osx/build_gh_action.sh - name: Test Import @@ -113,9 +118,10 @@ 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: + 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 3620ee78..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] + python: [3.6, 3.7, 3.8, 3.9, 3.10-dev] steps: - uses: actions/checkout@v2 - name: Set up Python @@ -37,6 +37,7 @@ jobs: - name: Build env: BUILD_PYTHON: ${{ matrix.python }} + CRC32C_PURE_PYTHON: "0" run: | ./scripts/manylinux/build.sh - name: Test Import @@ -56,7 +57,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.10-dev] steps: - uses: actions/checkout@v2 - name: Set up Python @@ -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 @@ -87,7 +90,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.10-dev] steps: - uses: actions/checkout@v2 - name: Add msbuild to PATH @@ -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/CHANGELOG.md b/CHANGELOG.md index c845a96d..a644191c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ [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) + + +### 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/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` 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 \ 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}" 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 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