diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index 4de52be8..8c555956 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -575,7 +575,12 @@ fi # simply use our pip to install self. Kinda crazy, but it works! ${BUILD_PYTHON} "${PIP_WHEEL}/pip" install --prefix="${ROOT}/out/python/install" --no-cache-dir --no-index "${PIP_WHEEL}" -${BUILD_PYTHON} "${PIP_WHEEL}/pip" install --prefix="${ROOT}/out/python/install" --no-cache-dir --no-index "${SETUPTOOLS_WHEEL}" + +# Setuptools is only installed for Python 3.11 and older, for parity with +# `ensurepip` and `venv`: https://github.com/python/cpython/pull/101039 +if [ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_11}" ]; then + ${BUILD_PYTHON} "${PIP_WHEEL}/pip" install --prefix="${ROOT}/out/python/install" --no-cache-dir --no-index "${SETUPTOOLS_WHEEL}" +fi # Hack up the system configuration settings to aid portability. # diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 88bcf6e0..7be485aa 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -19,6 +19,7 @@ from pythonbuild.cpython import ( STDLIB_TEST_PACKAGES, + meets_python_maximum_version, meets_python_minimum_version, parse_config_c, ) @@ -1653,19 +1654,22 @@ def build_cpython( pip_env, ) - exec_and_log( - [ - str(install_dir / "python.exe"), - "-m", - "pip", - "install", - "--no-cache-dir", - "--no-index", - str(setuptools_wheel), - ], - td, - pip_env, - ) + # Setuptools is only installed for Python 3.11 and older, for parity with + # `ensurepip` and `venv`: https://github.com/python/cpython/pull/101039 + if meets_python_maximum_version(python_version, "3.11"): + exec_and_log( + [ + str(install_dir / "python.exe"), + "-m", + "pip", + "install", + "--no-cache-dir", + "--no-index", + str(setuptools_wheel), + ], + td, + pip_env, + ) # The executables in the Scripts/ directory don't work because they reference # python.dll in the wrong path. You can run these via e.g. `python.exe -m pip`. diff --git a/docs/running.rst b/docs/running.rst index 02e4e2a4..15d9df20 100644 --- a/docs/running.rst +++ b/docs/running.rst @@ -259,7 +259,7 @@ Extra Python Software Python installations have some additional software pre-installed: * `pip `_ -* `setuptools `_ +* `setuptools `_ (for Python 3.11 and older) The intent of the pre-installed software is to facilitate end-user package installation without having to first bootstrap a packaging