Skip to content

Commit b6759d2

Browse files
committed
Configurable build-details.json name
Linux distributions that co-install multiple Python versions in the same path (e.g. multiarch on Debian, debug builds, and free-threading) need a way to place multiple build-details.jsons side-by-side. PEP-739 is being updated [0] to recommend renaming in this situation. To ensure some standardization, this PR generates appropriate names for distributions that need to use this feature. [0]: python/peps#4889
1 parent 51a5715 commit b6759d2

3 files changed

Lines changed: 72 additions & 5 deletions

File tree

Makefile.pre.in

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
215215
# the build, and is only listed here so it will be included in sysconfigdata.
216216
IPHONEOS_DEPLOYMENT_TARGET=@IPHONEOS_DEPLOYMENT_TARGET@
217217

218+
BUILD_DETAILS=@BUILD_DETAILS@
219+
218220
# Option to install to strip binaries
219221
STRIPFLAG=-s
220222

@@ -774,11 +776,11 @@ list-targets:
774776

775777
.PHONY: build_all
776778
build_all: check-clean-src check-app-store-compliance $(BUILDPYTHON) platform sharedmods \
777-
gdbhooks Programs/_testembed scripts checksharedmods rundsymutil build-details.json
779+
gdbhooks Programs/_testembed scripts checksharedmods rundsymutil $(BUILD_DETAILS)
778780

779781
.PHONY: build_wasm
780782
build_wasm: check-clean-src $(BUILDPYTHON) platform sharedmods \
781-
python-config checksharedmods build-details.json
783+
python-config checksharedmods $(BUILD_DETAILS)
782784

783785
.PHONY: build_emscripten
784786
build_emscripten: build_wasm web_example web_example_pyrepl_jspi
@@ -979,8 +981,8 @@ pybuilddir.txt: $(PYTHON_FOR_BUILD_DEPS)
979981
exit 1 ; \
980982
fi
981983

982-
build-details.json: pybuilddir.txt
983-
$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/build/generate-build-details.py `cat pybuilddir.txt`/build-details.json
984+
$(BUILD_DETAILS): pybuilddir.txt
985+
$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/build/generate-build-details.py `cat pybuilddir.txt`/$(BUILD_DETAILS)
984986

985987
# Build static library
986988
$(LIBRARY): $(LIBRARY_OBJS)
@@ -2349,7 +2351,7 @@ multissltest: all
23492351
# Only the main install gets a build-details.json.
23502352
.PHONY: install
23512353
install: @FRAMEWORKINSTALLFIRST@ @INSTALLTARGETS@ @FRAMEWORKINSTALLLAST@
2352-
$(INSTALL_DATA) `cat pybuilddir.txt`/build-details.json $(DESTDIR)$(LIBDEST); \
2354+
$(INSTALL_DATA) `cat pybuilddir.txt`/$(BUILD_DETAILS) $(DESTDIR)$(LIBDEST); \
23532355
if test "x$(ENSUREPIP)" != "xno" ; then \
23542356
case $(ENSUREPIP) in \
23552357
upgrade) ensurepip="--upgrade" ;; \

configure

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7775,6 +7775,33 @@ AC_ARG_ENABLE([test-modules],
77757775
AC_MSG_RESULT([$TEST_MODULES])
77767776
AC_SUBST([TEST_MODULES])
77777777

7778+
# Check for --enable-colocated-install
7779+
AC_MSG_CHECKING([for --enable-colocated-install])
7780+
AC_ARG_ENABLE([colocated-install],
7781+
[AS_HELP_STRING(
7782+
[--enable-colocated-install],
7783+
[rename build-data.json to permit multiple colocated Python installs]
7784+
)],
7785+
[
7786+
colocated_install=yes;
7787+
threading_suffix="";
7788+
if [[ "$ABI_THREAD" = "t" ]]; then
7789+
threading_suffix=-free-threading;
7790+
fi;
7791+
debug_suffix="";
7792+
if [[ "$Py_DEBUG" = "true" ]]; then
7793+
debug_suffix=-debug;
7794+
fi;
7795+
BUILD_DETAILS=build-details.$MULTIARCH$threading_suffix$debug_suffix.json
7796+
], [
7797+
colocated_install=no;
7798+
BUILD_DETAILS=build-details.json
7799+
]
7800+
)
7801+
AC_MSG_RESULT([$colocated_install])
7802+
AC_SUBST([BUILD_DETAILS], [$BUILD_DETAILS])
7803+
7804+
77787805
# gh-109054: Check if -latomic is needed to get <pyatomic.h> atomic functions.
77797806
# On Linux aarch64, GCC may require programs and libraries to be linked
77807807
# explicitly to libatomic. Call _Py_atomic_or_uint64() which may require

0 commit comments

Comments
 (0)