Skip to content

Commit

Permalink
feat: add Python 3.9 support, drop Python 3.5 support (#42)
Browse files Browse the repository at this point in the history
* feat: build Python 3.9 wheels on manylinux

* chore: drop Python 3.5 support

Closes #38.
  • Loading branch information
tseaver committed Dec 12, 2020
1 parent 6c8883b commit 1d7fe63
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 34 deletions.
5 changes: 3 additions & 2 deletions noxfile.py
Expand Up @@ -21,7 +21,7 @@
from sys import platform


@nox.session(python=["3.5", "3.6", "3.7", "3.8"])
@nox.session(python=["3.6", "3.7", "3.8", "3.9"])
def build_libcrc32c(session):
if platform.startswith("win"):
session.run("cmd", "-c", "scripts\\windows\\build.bat")
Expand All @@ -33,8 +33,9 @@ def build_libcrc32c(session):
raise Exception("Unsupported")


@nox.session(python=["3.5", "3.6", "3.7", "3.8"])
@nox.session(python=["3.6", "3.7", "3.8", "3.9"])
def check(session):
session.install("cffi>=1.0.0")
session.install("--no-index", "--find-links=wheels", "google-crc32c")

# Run py.test against the unit tests.
Expand Down
8 changes: 4 additions & 4 deletions scripts/manylinux/build_on_centos.sh
Expand Up @@ -40,10 +40,7 @@ make all install
VERSION_WHITELIST=""
for PYTHON_BIN in /opt/python/*/bin; do
# H/T: https://stackoverflow.com/a/229606/1068170
if [[ "${PYTHON_BIN}" == *"35"* ]]; then
VERSION_WHITELIST="${VERSION_WHITELIST} ${PYTHON_BIN}"
continue
elif [[ "${PYTHON_BIN}" == *"36"* ]]; then
if [[ "${PYTHON_BIN}" == *"36"* ]]; then
VERSION_WHITELIST="${VERSION_WHITELIST} ${PYTHON_BIN}"
continue
elif [[ "${PYTHON_BIN}" == *"37"* ]]; then
Expand All @@ -52,6 +49,9 @@ for PYTHON_BIN in /opt/python/*/bin; do
elif [[ "${PYTHON_BIN}" == *"38"* ]]; then
VERSION_WHITELIST="${VERSION_WHITELIST} ${PYTHON_BIN}"
continue
elif [[ "${PYTHON_BIN}" == *"39"* ]]; then
VERSION_WHITELIST="${VERSION_WHITELIST} ${PYTHON_BIN}"
continue
else
echo "Ignoring unsupported version: ${PYTHON_BIN}"
echo "====================================="
Expand Down
23 changes: 12 additions & 11 deletions scripts/osx/build.sh
Expand Up @@ -24,10 +24,10 @@ SCRIPTS_DIR=$(dirname ${OSX_DIR})
export REPO_ROOT=$(dirname ${SCRIPTS_DIR})

# NOTE: These are the Python.org versions of Python.
PYTHON35="/Library/Frameworks/Python.framework/Versions/3.5/bin"
PYTHON36="/Library/Frameworks/Python.framework/Versions/3.6/bin"
PYTHON37="/Library/Frameworks/Python.framework/Versions/3.7/bin"
PYTHON38="/Library/Frameworks/Python.framework/Versions/3.8/bin"
PYTHON39="/Library/Frameworks/Python.framework/Versions/3.9/bin"

# Build and install `libcrc32c`
export PY_BIN="python3"
Expand All @@ -38,11 +38,6 @@ git submodule update --init --recursive

${OSX_DIR}/build_c_lib.sh

# Build wheel for Python 3.5.
export PY_BIN="python3.5"
export PY_TAG="cp35-cp35m"
${OSX_DIR}/build_python_wheel.sh

# Build wheel for Python 3.6.
export PY_BIN="python3.6"
export PY_TAG="cp36-cp36m"
Expand All @@ -53,11 +48,17 @@ export PY_BIN="python3.7"
export PY_TAG="cp37-cp37m"
${OSX_DIR}/build_python_wheel.sh

# TODO: As of 2019-Dec-30, 3.8 is not available on our CI
# Build wheel for Python 3.7.
# export PY_BIN="python3.8"
# export PY_TAG="cp38-cp38m"
# ${OSX_DIR}/build_python_wheel.sh
# Build wheel for Python 3.8.
# Note that the 'm' SOABI flag is no longer supported for Python >= 3.8
export PY_BIN="python3.8"
export PY_TAG="cp38-cp38"
${OSX_DIR}/build_python_wheel.sh

# TODO: As of 2020-12-11, 3.9 is not available on our CI
# Build wheel for Python 3.9.
#export PY_BIN="python3.9"
#export PY_TAG="cp39-cp39"
#${OSX_DIR}/build_python_wheel.sh


# Clean up.
Expand Down
26 changes: 13 additions & 13 deletions scripts/osx/check.sh
Expand Up @@ -28,7 +28,6 @@ export REPO_ROOT=$(dirname ${SCRIPTS_DIR})
ls ${REPO_ROOT}/wheels

# NOTE: These are the Python.org versions of Python.
PYTHON35="/Library/Frameworks/Python.framework/Versions/3.5/bin"
PYTHON36="/Library/Frameworks/Python.framework/Versions/3.6/bin"
PYTHON37="/Library/Frameworks/Python.framework/Versions/3.7/bin"
PYTHON38="/Library/Frameworks/Python.framework/Versions/3.8/bin"
Expand All @@ -45,13 +44,6 @@ ${PYTHON37}/python3 -m pip install --upgrade delocate
LISTDEPS_CMD="${PYTHON37}/delocate-listdeps --all --depending"
VIRTUALENV_CMD="${PYTHON37}/python3 -m venv"

${PYTHON35}/python3 -m venv venv35
curl https://bootstrap.pypa.io/get-pip.py | venv35/bin/python3
WHL=${REPO_ROOT}/wheels/google_crc32c-${PACKAGE_VERSION}-cp35-cp35m-macosx_10_6_intel.whl
venv35/bin/pip install ${WHL}
venv35/bin/python ${REPO_ROOT}/scripts/check_cffi_crc32c.py
${LISTDEPS_CMD} ${WHL}
rm -fr venv35

${PYTHON36}/python3 -m venv venv36
curl https://bootstrap.pypa.io/get-pip.py | venv36/bin/python3
Expand All @@ -69,11 +61,19 @@ venv37/bin/python ${REPO_ROOT}/scripts/check_cffi_crc32c.py
${LISTDEPS_CMD} ${WHL}
rm -fr venv37

# TODO: As of 2019-Dec-30, 3.8 is not available on our CI
# ${PYTHON38}/python3 -m venv venv38
# curl https://bootstrap.pypa.io/get-pip.py | venv38/bin/python3
# WHL=${REPO_ROOT}/wheels/google_crc32c-${PACKAGE_VERSION}-cp38-cp38m-macosx_10_9_x86_64.whl
${PYTHON38}/python3 -m venv venv38
curl https://bootstrap.pypa.io/get-pip.py | venv38/bin/python3
WHL=${REPO_ROOT}/wheels/google_crc32c-${PACKAGE_VERSION}-cp38-cp38-macosx_10_9_x86_64.whl
venv38/bin/pip install ${WHL}
venv38/bin/python ${REPO_ROOT}/scripts/check_cffi_crc32c.py
${LISTDEPS_CMD} ${WHL}
rm -fr venv38

# TODO: As of 2020-12-11, 3.9 is not available on our CI
# ${PYTHON39}/python3 -m venv venv39
# curl https://bootstrap.pypa.io/get-pip.py | venv39/bin/python3
# WHL=${REPO_ROOT}/wheels/google_crc32c-${PACKAGE_VERSION}-cp39-cp39-macosx_10_9_x86_64.whl
# venv37/bin/pip install ${WHL}
# venv37/bin/python ${REPO_ROOT}/scripts/check_cffi_crc32c.py
# ${LISTDEPS_CMD} ${WHL}
# rm -fr venv38
# rm -fr venv39
4 changes: 2 additions & 2 deletions scripts/windows/build.bat
Expand Up @@ -49,7 +49,7 @@ popd
copy %CRC32C_INSTALL_PREFIX%bin\google_crc32c.dll .

@rem update python deps and build wheels (requires CRC32C_INSTALL_PREFIX is set)
FOR %%V IN (3.5-64,3.6-64,3.7-64) DO (
FOR %%V IN (3.6-64,3.7-64) DO (
py -%%V -m pip install --upgrade pip setuptools wheel
py -%%V -m pip wheel . --wheel-dir wheels/
)
Expand Down Expand Up @@ -77,7 +77,7 @@ popd
copy %CRC32C_INSTALL_PREFIX%bin\google_crc32c.dll .

@rem update python deps and build wheels (requires CRC32C_INSTALL_PREFIX is set)
FOR %%V IN (3.5-32,3.6-32,3.7-32) DO (
FOR %%V IN (3.6-32,3.7-32) DO (
py -%%V -m pip install --upgrade pip setuptools wheel
py -%%V -m pip wheel . --wheel-dir wheels/
)
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Expand Up @@ -30,14 +30,14 @@ classifiers =
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9

[options]
zip_safe = True
python_requires = >=3.5
python_requires = >=3.6

[options.extras_require]
testing = pytest
Expand Down

0 comments on commit 1d7fe63

Please sign in to comment.