From 4132db06142e67cf64e0c745f267fa2f3ae9ef54 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Thu, 25 Jul 2024 03:24:18 -0400 Subject: [PATCH 1/5] Allow builds with different ABIs to be installed to a common prefix by avoiding overlapping file names. --- Makefile.pre.in | 64 +++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 39 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index 9ea7bc49be316c..16b063ca8325ac 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -2213,12 +2213,6 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@ else \ $(INSTALL_PROGRAM) $(STRIPFLAG) Mac/pythonw $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \ fi - -if test "$(VERSION)" != "$(LDVERSION)"; then \ - if test -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) -o -h $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \ - then rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \ - fi; \ - (cd $(DESTDIR)$(BINDIR); $(LN) python$(LDVERSION)$(EXE) python$(VERSION)$(EXE)); \ - fi @if test "$(PY_ENABLE_SHARED)" = 1 -o "$(STATIC_LIBPYTHON)" = 1; then \ if test -f $(LDLIBRARY) && test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \ if test -n "$(DLLLIBRARY)" ; then \ @@ -2236,16 +2230,16 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@ fi; \ fi if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \ - rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-32$(EXE); \ + rm -f $(DESTDIR)$(BINDIR)/python$(LDVERSION)-32$(EXE); \ lipo $(LIPO_32BIT_FLAGS) \ - -output $(DESTDIR)$(BINDIR)/python$(VERSION)-32$(EXE) \ - $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \ + -output $(DESTDIR)$(BINDIR)/python$(LDVERSION)-32$(EXE) \ + $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \ fi if test "x$(LIPO_INTEL64_FLAGS)" != "x" ; then \ - rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-intel64$(EXE); \ + rm -f $(DESTDIR)$(BINDIR)/python$(LDVERSION)-intel64$(EXE); \ lipo $(LIPO_INTEL64_FLAGS) \ - -output $(DESTDIR)$(BINDIR)/python$(VERSION)-intel64$(EXE) \ - $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \ + -output $(DESTDIR)$(BINDIR)/python$(LDVERSION)-intel64$(EXE) \ + $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \ fi # Install macOS debug information (if available) if test -d "$(BUILDPYTHON).dSYM"; then \ @@ -2274,36 +2268,28 @@ bininstall: commoninstall altbininstall echo "Creating directory $(LIBPC)"; \ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC); \ fi - -if test -f $(DESTDIR)$(BINDIR)/python3$(EXE) -o -h $(DESTDIR)$(BINDIR)/python3$(EXE); \ - then rm -f $(DESTDIR)$(BINDIR)/python3$(EXE); \ + -if test -f $(DESTDIR)$(BINDIR)/python3$(ABIFLAGS)$(EXE) -o -h $(DESTDIR)$(BINDIR)/python3$(ABIFLAGS)$(EXE); \ + then rm -f $(DESTDIR)$(BINDIR)/python3$(ABIFLAGS)$(EXE); \ else true; \ fi - (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python3$(EXE)) - -if test "$(VERSION)" != "$(LDVERSION)"; then \ - rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-config; \ - (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config python$(VERSION)-config); \ - rm -f $(DESTDIR)$(LIBPC)/python-$(VERSION).pc; \ - (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(LDVERSION).pc python-$(VERSION).pc); \ - rm -f $(DESTDIR)$(LIBPC)/python-$(VERSION)-embed.pc; \ - (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(LDVERSION)-embed.pc python-$(VERSION)-embed.pc); \ - fi - -rm -f $(DESTDIR)$(BINDIR)/python3-config - (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config) - -rm -f $(DESTDIR)$(LIBPC)/python3.pc - (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc) - -rm -f $(DESTDIR)$(LIBPC)/python3-embed.pc - (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python3-embed.pc) - -rm -f $(DESTDIR)$(BINDIR)/idle3 - (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3) - -rm -f $(DESTDIR)$(BINDIR)/pydoc3 - (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) + (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python3$(ABIFLAGS)$(EXE)) + -rm -f $(DESTDIR)$(BINDIR)/python3$(ABIFLAGS)-config + (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config python3$(ABIFLAGS)-config) + -rm -f $(DESTDIR)$(LIBPC)/python3$(ABIFLAGS).pc + (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(LDVERSION).pc python3$(ABIFLAGS).pc) + -rm -f $(DESTDIR)$(LIBPC)/python3$(ABIFLAGS)-embed.pc + (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(LDVERSION)-embed.pc python3$(ABIFLAGS)-embed.pc) + -rm -f $(DESTDIR)$(BINDIR)/idle3$(ABIFLAGS) + (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(LDVERSION) idle3$(ABIFLAGS)) + -rm -f $(DESTDIR)$(BINDIR)/pydoc3$(ABIFLAGS) + (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(LDVERSION) pydoc3$(ABIFLAGS)) if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \ - rm -f $(DESTDIR)$(BINDIR)/python3-32$(EXE); \ - (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-32$(EXE) python3-32$(EXE)) \ + rm -f $(DESTDIR)$(BINDIR)/python3$(ABIFLAGS)-32$(EXE); \ + (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-32$(EXE) python3$(ABIFLAGS)-32$(EXE)) \ fi if test "x$(LIPO_INTEL64_FLAGS)" != "x" ; then \ - rm -f $(DESTDIR)$(BINDIR)/python3-intel64$(EXE); \ - (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-intel64$(EXE) python3-intel64$(EXE)) \ + rm -f $(DESTDIR)$(BINDIR)/python3$(ABIFLAGS)-intel64$(EXE); \ + (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-intel64$(EXE) python3$(ABIFLAGS)-intel64$(EXE)) \ fi # Install the versioned manual page @@ -2737,8 +2723,8 @@ libainstall: all scripts $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config - $(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION) - $(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION) + $(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(LDVERSION) + $(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(LDVERSION) @if [ -s Modules/python.exp -a \ "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ echo; echo "Installing support files for building shared extension modules on AIX:"; \ From 3c7f9bcc53096e4f89b3afe75dde76ca0b6a27e8 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Thu, 25 Jul 2024 05:13:57 -0400 Subject: [PATCH 2/5] Simplify bininstall --- Makefile.pre.in | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index 16b063ca8325ac..da76604e8bf079 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -2264,15 +2264,8 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@ # problems for anything else trying to run 'python3' while we install, particularly # if we're installing in parallel with -j. bininstall: commoninstall altbininstall - if test ! -d $(DESTDIR)$(LIBPC); then \ - echo "Creating directory $(LIBPC)"; \ - $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC); \ - fi - -if test -f $(DESTDIR)$(BINDIR)/python3$(ABIFLAGS)$(EXE) -o -h $(DESTDIR)$(BINDIR)/python3$(ABIFLAGS)$(EXE); \ - then rm -f $(DESTDIR)$(BINDIR)/python3$(ABIFLAGS)$(EXE); \ - else true; \ - fi - (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python3$(ABIFLAGS)$(EXE)) + -rm -f $(DESTDIR)$(BINDIR)/python3$(ABIFLAGS)$(EXE) + (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)$(EXE) python3$(ABIFLAGS)$(EXE)) -rm -f $(DESTDIR)$(BINDIR)/python3$(ABIFLAGS)-config (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config python3$(ABIFLAGS)-config) -rm -f $(DESTDIR)$(LIBPC)/python3$(ABIFLAGS).pc From c031337dd1efd32ffa9ec861af89addadd5b00f7 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Mon, 29 Jul 2024 02:49:15 -0400 Subject: [PATCH 3/5] Retain link to unsuffixed binary file names for framework builds to not break venvs. --- Makefile.pre.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile.pre.in b/Makefile.pre.in index da76604e8bf079..063f02d2b03d15 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -2213,6 +2213,14 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@ else \ $(INSTALL_PROGRAM) $(STRIPFLAG) Mac/pythonw $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \ fi + # For framework installs, the unsuffixed binary file name is currently + # needed for getpath.py setting of sys._base_executable for venv's + -if test "$(VERSION)" != "$(LDVERSION)" && test "$(PYTHONFRAMEWORKDIR)" != "no-framework"; then \ + if test -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) -o -h $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \ + then rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \ + fi; \ + (cd $(DESTDIR)$(BINDIR); $(LN) python$(LDVERSION)$(EXE) python$(VERSION)$(EXE)); \ + fi @if test "$(PY_ENABLE_SHARED)" = 1 -o "$(STATIC_LIBPYTHON)" = 1; then \ if test -f $(LDLIBRARY) && test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \ if test -n "$(DLLLIBRARY)" ; then \ From 729732615e49308f85f09050f337ec0709a6fa81 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Mon, 29 Jul 2024 04:55:38 -0400 Subject: [PATCH 4/5] Only install relevant prefix/bin symlinks for framework installs. --- Mac/Makefile.in | 62 +++++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 36 deletions(-) diff --git a/Mac/Makefile.in b/Mac/Makefile.in index 32e3a0f55c5d71..98d5ce2d2ff0b0 100644 --- a/Mac/Makefile.in +++ b/Mac/Makefile.in @@ -63,29 +63,19 @@ installunixtools: fi cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ for fn in \ - idle3 \ - pydoc3 \ - python3 \ - python3-config \ + idle3$(ABIFLAGS) \ + pydoc3$(ABIFLAGS) \ + python3$(ABIFLAGS) \ + python3$(ABIFLAGS)-config \ ; \ do \ rm -f $${fn} ; \ $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ done - -if test "x$(VERSION)" != "x$(LDVERSION)"; then \ - cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ - for fn in \ - python$(VERSION)-config \ - ; \ - do \ - rm -f $${fn} ;\ - $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ - done ;\ - fi -if test "x$(LIPO_32BIT_FLAGS)" != "x"; then \ cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ for fn in \ - python3-32 \ + python3-32$(ABIFLAGS) \ ; \ do \ rm -f $${fn} ;\ @@ -95,7 +85,7 @@ installunixtools: -if test "x$(LIPO_INTEL64_FLAGS)" != "x"; then \ cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ for fn in \ - python3-intel64 \ + python3-intel64$(ABIFLAGS) \ ; \ do \ rm -f $${fn} ;\ @@ -108,8 +98,13 @@ installunixtools: pip3 \ ; \ do \ - rm -f $${fn} ;\ - $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ + if test "x$(VERSION)" != "x$(LDVERSION)"; then \ + rm -f $${fn}$(ABIFLAGS) ;\ + $(LN) -s $(BINDIR)/$${fn} $${fn}$(ABIFLAGS) ;\ + else \ + rm -f $${fn} ;\ + $(LN) -s $(BINDIR)/$${fn} ;\ + fi ;\ done ;\ fi @@ -122,29 +117,19 @@ altinstallunixtools: fi cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ for fn in \ - idle$(VERSION) \ - pydoc$(VERSION) \ - python$(VERSION) \ + idle$(LDVERSION) \ + pydoc$(LDVERSION) \ + python$(LDVERSION) \ python$(LDVERSION)-config \ ; \ do \ rm -f $${fn} ;\ $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ done - -if test "x$(VERSION)" != "x$(LDVERSION)"; then \ - cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ - for fn in \ - python$(LDVERSION) \ - ; \ - do \ - rm -f $${fn} ;\ - $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ - done ;\ - fi -if test "x$(LIPO_32BIT_FLAGS)" != "x"; then \ cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ for fn in \ - python$(VERSION)-32 \ + python$(LDVERSION)-32 \ ; \ do \ rm -f $${fn} ;\ @@ -154,7 +139,7 @@ altinstallunixtools: -if test "x$(LIPO_INTEL64_FLAGS)" != "x"; then \ cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ for fn in \ - python$(VERSION)-intel64 \ + python$(LDVERSION)-intel64 \ ; \ do \ rm -f $${fn} ;\ @@ -164,11 +149,16 @@ altinstallunixtools: -if test "x$(ENSUREPIP)" != "xno" ; then \ cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ for fn in \ - pip$(VERSION) \ + pip \ ; \ do \ - rm -f $${fn} ;\ - $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ + if test "x$(VERSION)" != "x$(LDVERSION)"; then \ + rm -f $${fn}$(LDVERSION) ;\ + $(LN) -s $(BINDIR)/$${fn}$(VERSION) $${fn}$(LDVERSION) ;\ + else \ + rm -f $${fn}$(VERSION) ;\ + $(LN) -s $(BINDIR)/$${fn}$(VERSION) $${fn}$(VERSION) ;\ + fi ;\ done ;\ fi From c772271f8dfa35fbdf6b015ad0a87341476ae4c3 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Mon, 29 Jul 2024 11:04:27 -0400 Subject: [PATCH 5/5] add blurb --- .../next/Build/2024-07-29-11-04-06.gh-issue-122402.HZAQXX.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Build/2024-07-29-11-04-06.gh-issue-122402.HZAQXX.rst diff --git a/Misc/NEWS.d/next/Build/2024-07-29-11-04-06.gh-issue-122402.HZAQXX.rst b/Misc/NEWS.d/next/Build/2024-07-29-11-04-06.gh-issue-122402.HZAQXX.rst new file mode 100644 index 00000000000000..5dde70ae6a21c8 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2024-07-29-11-04-06.gh-issue-122402.HZAQXX.rst @@ -0,0 +1 @@ +Eliminate conflicts between build variants installed to a common prefix.