Skip to content

Commit 14d98ac

Browse files
committed
Final patch for issue 9807.
1 parent fdba067 commit 14d98ac

7 files changed

Lines changed: 332 additions & 328 deletions

File tree

Lib/distutils/command/install.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
'unix_prefix': {
4949
'purelib': '$base/lib/python$py_version_short/site-packages',
5050
'platlib': '$platbase/lib/python$py_version_short/site-packages',
51-
'headers': '$base/include/python$py_version_short/$dist_name',
51+
'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
5252
'scripts': '$base/bin',
5353
'data' : '$base',
5454
},
@@ -82,7 +82,8 @@
8282
INSTALL_SCHEMES['unix_user'] = {
8383
'purelib': '$usersite',
8484
'platlib': '$usersite',
85-
'headers': '$userbase/include/python$py_version_short/$dist_name',
85+
'headers':
86+
'$userbase/include/python$py_version_short$abiflags/$dist_name',
8687
'scripts': '$userbase/bin',
8788
'data' : '$userbase',
8889
}
@@ -322,6 +323,7 @@ def finalize_options(self):
322323
'prefix': prefix,
323324
'sys_exec_prefix': exec_prefix,
324325
'exec_prefix': exec_prefix,
326+
'abiflags': sys.abiflags,
325327
}
326328

327329
if HAS_USER_SITE:

Lib/distutils/sysconfig.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
__revision__ = "$Id$"
1313

14-
import io
1514
import os
1615
import re
1716
import sys
@@ -49,6 +48,18 @@ def _python_build():
4948
return False
5049
python_build = _python_build()
5150

51+
# Calculate the build qualifier flags if they are defined. Adding the flags
52+
# to the include and lib directories only makes sense for an installation, not
53+
# an in-source build.
54+
build_flags = ''
55+
try:
56+
if not python_build:
57+
build_flags = sys.abiflags
58+
except AttributeError:
59+
# It's not a configure-based build, so the sys module doesn't have
60+
# this attribute, which is fine.
61+
pass
62+
5263
def get_python_version():
5364
"""Return a string containing the major and minor Python version,
5465
leaving off the patchlevel. Sample return values could be '1.5'
@@ -83,7 +94,8 @@ def get_python_inc(plat_specific=0, prefix=None):
8394
else:
8495
incdir = os.path.join(get_config_var('srcdir'), 'Include')
8596
return os.path.normpath(incdir)
86-
return os.path.join(prefix, "include", "python" + get_python_version())
97+
python_dir = 'python' + get_python_version() + build_flags
98+
return os.path.join(prefix, "include", python_dir)
8799
elif os.name == "nt":
88100
return os.path.join(prefix, "include")
89101
elif os.name == "os2":
@@ -209,7 +221,8 @@ def get_makefile_filename():
209221
if python_build:
210222
return os.path.join(os.path.dirname(sys.executable), "Makefile")
211223
lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
212-
return os.path.join(lib_dir, "config", "Makefile")
224+
config_file = 'config-{}{}'.format(get_python_version(), build_flags)
225+
return os.path.join(lib_dir, config_file, 'Makefile')
213226

214227

215228
def parse_config_h(fp, g=None):

Lib/sysconfig.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
'platstdlib': '{platbase}/lib/python{py_version_short}',
2626
'purelib': '{base}/lib/python{py_version_short}/site-packages',
2727
'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
28-
'include': '{base}/include/python{py_version_short}',
29-
'platinclude': '{platbase}/include/python{py_version_short}',
28+
'include':
29+
'{base}/include/python{py_version_short}{abiflags}',
30+
'platinclude':
31+
'{platbase}/include/python{py_version_short}{abiflags}',
3032
'scripts': '{base}/bin',
3133
'data': '{base}',
3234
},
@@ -317,7 +319,9 @@ def get_makefile_filename():
317319
"""Return the path of the Makefile."""
318320
if _PYTHON_BUILD:
319321
return os.path.join(_PROJECT_BASE, "Makefile")
320-
return os.path.join(get_path('stdlib'), "config", "Makefile")
322+
return os.path.join(get_path('stdlib'),
323+
'config-{}{}'.format(_PY_VERSION_SHORT, sys.abiflags),
324+
'Makefile')
321325

322326

323327
def _init_posix(vars):
@@ -471,6 +475,7 @@ def get_config_vars(*args):
471475
_CONFIG_VARS['base'] = _PREFIX
472476
_CONFIG_VARS['platbase'] = _EXEC_PREFIX
473477
_CONFIG_VARS['projectbase'] = _PROJECT_BASE
478+
_CONFIG_VARS['abiflags'] = sys.abiflags
474479

475480
if os.name in ('nt', 'os2'):
476481
_init_non_posix(_CONFIG_VARS)

Makefile.pre.in

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,8 @@ ABIFLAGS= @ABIFLAGS@
108108
# Detailed destination directories
109109
BINLIBDEST= $(LIBDIR)/python$(VERSION)
110110
LIBDEST= $(SCRIPTDIR)/python$(VERSION)
111-
INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
112-
CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
113-
LIBP= $(LIBDIR)/python$(VERSION)
111+
INCLUDEPY= $(INCLUDEDIR)/python$(LDVERSION)
112+
CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION)
114113

115114
# Symbols used for using shared libraries
116115
SO= @SO@
@@ -834,7 +833,7 @@ altbininstall: $(BUILDPYTHON)
834833
else true; \
835834
fi; \
836835
done
837-
$(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
836+
$(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE)
838837
if test -f $(LDLIBRARY); then \
839838
if test -n "$(DLLLIBRARY)" ; then \
840839
$(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
@@ -852,11 +851,20 @@ bininstall: altbininstall
852851
then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON)3$(EXE); \
853852
else true; \
854853
fi
854+
-if test -f $(DESTDIR)$(BINDIR)/$(PYTHON)$(VERSION)$(EXE) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON)$(VERSION)$(EXE); \
855+
then rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
856+
else true; \
857+
fi
858+
(cd $(DESTDIR)$(BINDIR); $(LN) python$(LDVERSION)$(EXE) python$(VERSION)$(EXE))
855859
(cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON)3$(EXE))
856860
-rm -f $(DESTDIR)$(BINDIR)/python3-config
861+
-rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-config
862+
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config python$(VERSION)-config)
857863
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config)
858864
-rm -f $(DESTDIR)$(LIBPC)/python3.pc
865+
-rm -f $(DESTDIR)$(LIBPC)/python-$(LDVERSION).pc
859866
(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc)
867+
(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python-$(LDVERSION).pc)
860868

861869
# Install the manual page
862870
maninstall:
@@ -986,7 +994,7 @@ $(srcdir)/Lib/$(PLATDIR):
986994
python-config: $(srcdir)/Misc/python-config.in
987995
# Substitution happens here, as the completely-expanded BINDIR
988996
# is not available in configure
989-
sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
997+
sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
990998

991999
# Install the include files
9921000
INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
@@ -1008,13 +1016,13 @@ inclinstall:
10081016

10091017
# Install the library and miscellaneous stuff needed for extending/embedding
10101018
# This goes into $(exec_prefix)
1011-
LIBPL= $(LIBP)/config
1019+
LIBPL= $(LIBDEST)/config-$(LDVERSION)
10121020

10131021
# pkgconfig directory
10141022
LIBPC= $(LIBDIR)/pkgconfig
10151023

10161024
libainstall: all python-config
1017-
@for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
1025+
@for i in $(LIBDIR) $(LIBPL) $(LIBPC); \
10181026
do \
10191027
if test ! -d $(DESTDIR)$$i; then \
10201028
echo "Creating directory $$i"; \
@@ -1044,7 +1052,7 @@ libainstall: all python-config
10441052
$(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
10451053
$(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
10461054
$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
1047-
$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
1055+
$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
10481056
rm python-config
10491057
@if [ -s Modules/python.exp -a \
10501058
"`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \

Misc/python.pc.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# See: man pkg-config
12
prefix=@prefix@
23
exec_prefix=@exec_prefix@
34
libdir=@libdir@
@@ -9,5 +10,4 @@ Requires:
910
Version: @VERSION@
1011
Libs.private: @LIBS@
1112
Libs: -L${libdir} -lpython@VERSION@@ABIFLAGS@
12-
Cflags: -I${includedir}/python@VERSION@
13-
13+
Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@

0 commit comments

Comments
 (0)