Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Fix builds on Python < 3.12 #583

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
env:
PYTHON_VERSION: ${{ format('3.{0}', matrix.python3-minor-version) }}
PYTHON_EXECUTABLE: ${{ format('cp3{0}', matrix.python3-minor-version) }}
SETUPTOOLS_USE_DISTUTILS: ${{ matrix.python3-minor-version == 12 && 'local' || 'stdlib' }}

runs-on: ${{ matrix.os }}
name: Build and Deploy (${{ matrix.os }}, 3.${{ matrix.python3-minor-version }})
Expand Down Expand Up @@ -73,8 +74,8 @@ jobs:
pip install -r build_tools/build_requirements.txt &&
pip install -r requirements.txt
CIBW_BUILD: "${{ env.PYTHON_EXECUTABLE }}-*"
CIBW_ENVIRONMENT: CC=gcc
CIBW_ENVIRONMENT_MACOS: PMD_MPL_BACKEND=TkAgg PYTHON_CROSSENV=true
CIBW_ENVIRONMENT: CC=gcc SETUPTOOLS_USE_DISTUTILS=${{ env.SETUPTOOLS_USE_DISTUTILS }}
CIBW_ENVIRONMENT_MACOS: PMD_MPL_BACKEND=TkAgg PYTHON_CROSSENV=true SETUPTOOLS_USE_DISTUTILS=${{ env.SETUPTOOLS_USE_DISTUTILS }}
CIBW_ENVIRONMENT_PASS_LINUX: GITHUB_REF
# No support for pypy or musl
CIBW_SKIP: "pp* *-musllinux_*"
Expand Down
8 changes: 8 additions & 0 deletions build_tools/circle/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ function build_wheel {
ucs_tag="${ucs_tag}u"
fi

distutils_version=""
if [ "$pyver" = "3.12" ]; then
distutils_version="local"
else
distutils_version="stdlib"
fi

ML_PYTHON_VERSION=$(python -c \
"print('cp{maj}{min}-cp{maj}{min}{ucs}'.format( \
maj='${pyver}'.split('.')[0], \
Expand All @@ -33,6 +40,7 @@ function build_wheel {
-v `pwd`:/io \
-e "PYTHON_VERSION=${ML_PYTHON_VERSION}" \
-e "PMDARIMA_VERSION=${PMDARIMA_VERSION}" \
-e "SETUPTOOLS_USE_DISTUTILS=${distutils_version}" \
"${ML_IMAGE}" "/io/build_tools/circle/dind/build_manylinux_wheel.sh"
sudo docker cp "${DOCKER_CONTAINER_NAME}:/io/dist/." "${_root}/dist/"
docker rm $(docker ps -a -f status=exited -q)
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ def do_setup():
from setuptools import setup
print("Setting up with setuptools")

# Needs to be unset when building sdist
os.environ.pop("SETUPTOOLS_USE_DISTUTILS", None)

# TODO: distutils is removed in Python 3.12+, so this should probably be the default
if IS_PYTHON_312:
from setuptools import Extension
Expand Down
Loading