2020
2121# See: https://www.python.org/downloads/ -> "OpenPGP Public Keys"
2222case " ${VERSION} " in
23- 3.10 .* )
23+ 3.1[0-1] .* )
2424 # https://keybase.io/pablogsal/
2525 GPG_KEY_FINGERPRINT=' A035C8C19219BA821ECEA86B64E628F8D684696D'
2626 ;;
@@ -85,7 +85,7 @@ if [[ "${VERSION}" != 3.7.* ]]; then
8585 )
8686fi
8787
88- if [[ " ${VERSION} " == 3.10 .* ]]; then
88+ if [[ " ${VERSION} " != 3.[7-9] .* ]]; then
8989 CONFIGURE_OPTS+=(
9090 # Shared builds are beneficial for a number of reasons:
9191 # - Reduces the size of the build, since it avoids the duplication between
@@ -108,6 +108,17 @@ if [[ "${VERSION}" == 3.10.* ]]; then
108108 )
109109fi
110110
111+ if [[ " ${VERSION} " == 3.11.* ]]; then
112+ CONFIGURE_OPTS+=(
113+ # Skip building the test modules, since we remove them after the build anyway.
114+ # This feature was added in Python 3.10+, however it wasn't until Python 3.11
115+ # that compatibility issues between it and PGO were fixed:
116+ # https://github.com/python/cpython/pull/29315
117+ # TODO: See if a backport of that fix would be accepted to Python 3.10.
118+ " --disable-test-modules"
119+ )
120+ fi
121+
111122./configure " ${CONFIGURE_OPTS[@]} "
112123
113124# Using LDFLAGS we instruct the linker to omit all symbol information from the final binary
134145
135146# Remove unneeded test directories, similar to the official Docker Python images:
136147# https://github.com/docker-library/python
137- # TODO: Explore using -- disable-test-modules once the PGO fix is in a released Python version:
138- # https://bugs.python.org/issue45668
148+ # This is a no-op on Python 3.11+, since -- disable-test-modules will have prevented
149+ # the test files from having been built in the first place.
139150find " ${OUT_PREFIX} " -depth -type d -a \( -name ' test' -o -name ' tests' -o -name ' idle_test' \) -print -exec rm -rf ' {}' +
140151
141152# The `make install` step automatically generates `.pyc` files for the stdlib, however:
0 commit comments