python2: Fix dependencies, make it non-default python

This commit is contained in:
Alexey Pavlov
2019-07-09 13:28:15 +03:00
parent 5e1379fe55
commit 4c3da4df08
3 changed files with 36 additions and 20 deletions

View File

@@ -32,11 +32,11 @@ diff -Naur Python-2.7.9-orig/configure.ac Python-2.7.9/configure.ac
# generate output files
-AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
+AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh)
+AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python2-config.sh)
+
+AM_CONDITIONAL([MACHDEP_WIN32], [test "x$MACHDEP" = "xwin32"])
+AM_COND_IF([MACHDEP_WIN32],
+ [AC_CONFIG_FILES(Misc/python-config-u.sh)],
+ [AC_CONFIG_FILES(Misc/python2-config-u.sh)],
+ [])
+
AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
@@ -50,8 +50,8 @@ diff -Naur Python-2.7.9-orig/Makefile.pre.in Python-2.7.9/Makefile.pre.in
# is not available in configure
sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
+ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR}
+ sed -e "s,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g" < Misc/python-config.sh >python-config.sh
+ -sed -e "s,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g" < Misc/python-config-u.sh >python-config-u.sh
+ sed -e "s,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g" < Misc/python2-config.sh >python2-config.sh
+ -sed -e "s,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g" < Misc/python2-config-u.sh >python2-config-u.sh
# Install the include files
INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
@@ -59,14 +59,14 @@ diff -Naur Python-2.7.9-orig/Makefile.pre.in Python-2.7.9/Makefile.pre.in
$(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
+ $(INSTALL_SCRIPT) python-config.sh $(DESTDIR)$(BINDIR)/python-config.sh
+ -test -f python-config-u.sh && $(INSTALL_SCRIPT) python-config-u.sh $(DESTDIR)$(BINDIR)/python-config-u.sh
+ $(INSTALL_SCRIPT) python2-config.sh $(DESTDIR)$(BINDIR)/python2-config.sh
+ -test -f python2-config-u.sh && $(INSTALL_SCRIPT) python2-config-u.sh $(DESTDIR)$(BINDIR)/python2-config-u.sh
rm python-config
@if [ -s Modules/python.exp -a \
"`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
diff -Naur Python-2.7.9-orig/Misc/python-config.sh.in Python-2.7.9/Misc/python-config.sh.in
--- Python-2.7.9-orig/Misc/python-config.sh.in 1970-01-01 03:00:00.000000000 +0300
+++ Python-2.7.9/Misc/python-config.sh.in 2014-12-11 13:50:27.643400000 +0300
diff -Naur Python-2.7.9-orig/Misc/python2-config.sh.in Python-2.7.9/Misc/python2-config.sh.in
--- Python-2.7.9-orig/Misc/python2-config.sh.in 1970-01-01 03:00:00.000000000 +0300
+++ Python-2.7.9/Misc/python2-config.sh.in 2014-12-11 13:50:27.643400000 +0300
@@ -0,0 +1,127 @@
+#!/usr/bin/env sh
+
@@ -77,7 +77,7 @@ diff -Naur Python-2.7.9-orig/Misc/python-config.sh.in Python-2.7.9/Misc/python-c
+}
+
+# Really, python-config.py (and thus .sh) should be called directly, but
+# sometimes software (e.g. GDB) calls python-config.sh as if it were the
+# sometimes software (e.g. GDB) calls python2-config.sh as if it were the
+# Python executable, passing python-config.py as the first argument.
+# Work around that oddness by ignoring any .py passed as first arg.
+case "$1" in
@@ -195,17 +195,17 @@ diff -Naur Python-2.7.9-orig/Misc/python-config.sh.in Python-2.7.9/Misc/python-c
+done
+echo -ne $RESULT
+
diff -Naur Python-2.7.9-orig/Misc/python-config-u.sh.in Python-2.7.9/Misc/python-config-u.sh.in
--- Python-2.7.9-orig/Misc/python-config-u.sh.in 1970-01-01 03:00:00.000000000 +0300
+++ Python-2.7.9/Misc/python-config-u.sh.in 2014-12-11 13:50:27.643400000 +0300
diff -Naur Python-2.7.9-orig/Misc/python2-config-u.sh.in Python-2.7.9/Misc/python2-config-u.sh.in
--- Python-2.7.9-orig/Misc/python2-config-u.sh.in 1970-01-01 03:00:00.000000000 +0300
+++ Python-2.7.9/Misc/python2-config-u.sh.in 2014-12-11 13:50:27.643400000 +0300
@@ -0,0 +1,10 @@
+#!/usr/bin/env sh
+
+THISDIR="$(dirname $0)"
+test "$THISDIR" = "." && THISDIR=${PWD}
+
+RESULT=$("${THISDIR}"/python-config.sh "$@")
+RESULT=$("${THISDIR}"/python2-config.sh "$@")
+
+exec_prefix_win=$("${THISDIR}"/python-config.sh --exec-prefix)
+exec_prefix_win=$("${THISDIR}"/python2-config.sh --exec-prefix)
+exec_prefix_unix=@prefix@
+echo $(echo $RESULT | sed "s#${exec_prefix_win}#${exec_prefix_unix}#g")