diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index ba24b3a32..7e20b6397 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -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 }}) @@ -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_*" diff --git a/build_tools/circle/build_wheel.sh b/build_tools/circle/build_wheel.sh index d74c6de25..8785a1745 100755 --- a/build_tools/circle/build_wheel.sh +++ b/build_tools/circle/build_wheel.sh @@ -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], \ @@ -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) diff --git a/setup.py b/setup.py index d624c6dc2..1d82068d6 100644 --- a/setup.py +++ b/setup.py @@ -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