Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5553231

Browse files
committed
- Issue #23968: Rename the platform directory from plat-$(MACHDEP) to
plat-$(PLATFORM_TRIPLET). Rename the config directory (LIBPL) from config-$(LDVERSION) to config-$(LDVERSION)-$(PLATFORM_TRIPLET). Install the platform specifc _sysconfigdata module into the platform directory and rename it to include the ABIFLAGS.
1 parent c090876 commit 5553231

8 files changed

Lines changed: 117 additions & 14 deletions

File tree

Lib/distutils/sysconfig.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ def get_makefile_filename():
242242
return os.path.join(_sys_home or project_base, "Makefile")
243243
lib_dir = get_python_lib(plat_specific=0, standard_lib=1)
244244
config_file = 'config-{}{}'.format(get_python_version(), build_flags)
245+
if hasattr(sys.implementation, '_multiarch'):
246+
config_file += '-%s' % sys.implementation._multiarch
245247
return os.path.join(lib_dir, config_file, 'Makefile')
246248

247249

Lib/plat-linux/regen

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,33 @@
11
#! /bin/sh
22
case `uname` in
3-
Linux*) ;;
3+
Linux*|GNU*) ;;
44
*) echo Probably not on a Linux system 1>&2
55
exit 1;;
66
esac
7-
set -v
8-
h2py -i '(u_long)' /usr/include/sys/types.h /usr/include/netinet/in.h /usr/include/dlfcn.h
7+
if [ -z "$CC" ]; then
8+
echo >&2 "$(basename $0): CC is not set"
9+
exit 1
10+
fi
11+
headers="sys/types.h netinet/in.h dlfcn.h"
12+
incdirs="$(echo $($CC -v -E - < /dev/null 2>&1|awk '/^#include/, /^End of search/' | grep '^ '))"
13+
if [ -z "$incdirs" ]; then
14+
incdirs="/usr/include"
15+
fi
16+
for h in $headers; do
17+
absh=
18+
for d in $incdirs; do
19+
if [ -f "$d/$h" ]; then
20+
absh="$d/$h"
21+
break
22+
fi
23+
done
24+
if [ -n "$absh" ]; then
25+
absheaders="$absheaders $absh"
26+
else
27+
echo >&2 "$(basename $0): header $h not found"
28+
exit 1
29+
fi
30+
done
31+
32+
set -x
33+
${H2PY:-h2py} -i '(u_long)' $absheaders

Lib/sysconfig.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ def get_makefile_filename():
337337
config_dir_name = 'config-%s%s' % (_PY_VERSION_SHORT, sys.abiflags)
338338
else:
339339
config_dir_name = 'config'
340+
if hasattr(sys.implementation, '_multiarch'):
341+
config_dir_name += '-%s' % sys.implementation._multiarch
340342
return os.path.join(get_path('stdlib'), config_dir_name, 'Makefile')
341343

342344
def _generate_posix_vars():
@@ -379,7 +381,7 @@ def _generate_posix_vars():
379381
# _sysconfigdata module manually and populate it with the build vars.
380382
# This is more than sufficient for ensuring the subsequent call to
381383
# get_platform() succeeds.
382-
name = '_sysconfigdata'
384+
name = '_sysconfigdata_' + sys.abiflags
383385
if 'darwin' in sys.platform:
384386
import types
385387
module = types.ModuleType(name)
@@ -405,7 +407,9 @@ def _generate_posix_vars():
405407
def _init_posix(vars):
406408
"""Initialize the module as appropriate for POSIX systems."""
407409
# _sysconfigdata is generated at build time, see _generate_posix_vars()
408-
from _sysconfigdata import build_time_vars
410+
name = '_sysconfigdata_' + sys.abiflags
411+
_temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
412+
build_time_vars = _temp.build_time_vars
409413
vars.update(build_time_vars)
410414

411415
def _init_non_posix(vars):

Makefile.pre.in

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ MACHDEP= @MACHDEP@
109109

110110
# Multiarch directory (may be empty)
111111
MULTIARCH= @MULTIARCH@
112+
MULTIARCH_CPPFLAGS = @MULTIARCH_CPPFLAGS@
112113

113114
# Install prefix for architecture-independent files
114115
prefix= @prefix@
@@ -784,6 +785,7 @@ Python/dynload_hpux.o: $(srcdir)/Python/dynload_hpux.c Makefile
784785
Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile
785786
$(CC) -c $(PY_CORE_CFLAGS) \
786787
-DABIFLAGS='"$(ABIFLAGS)"' \
788+
$(MULTIARCH_CPPFLAGS) \
787789
-o $@ $(srcdir)/Python/sysmodule.c
788790

789791
$(IO_OBJS): $(IO_H)
@@ -1263,7 +1265,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
12631265
else true; \
12641266
fi; \
12651267
done
1266-
@for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py; \
1268+
@for i in $(srcdir)/Lib/*.py; \
12671269
do \
12681270
if test -x $$i; then \
12691271
$(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
@@ -1298,6 +1300,10 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
12981300
esac; \
12991301
done; \
13001302
done
1303+
$(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS).py \
1304+
$(DESTDIR)$(LIBDEST)/$(PLATDIR); \
1305+
echo $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS).py \
1306+
$(LIBDEST)/$(PLATDIR)
13011307
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
13021308
if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
13031309
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
@@ -1336,20 +1342,27 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
13361342
$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
13371343

13381344
# Create the PLATDIR source directory, if one wasn't distributed..
1345+
# For multiarch targets, use the plat-linux/regen script.
13391346
$(srcdir)/Lib/$(PLATDIR):
13401347
mkdir $(srcdir)/Lib/$(PLATDIR)
1341-
cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
1348+
if [ -n "$(MULTIARCH)" ]; then \
1349+
cp $(srcdir)/Lib/plat-linux/regen $(srcdir)/Lib/$(PLATDIR)/regen; \
1350+
else \
1351+
cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen; \
1352+
fi; \
13421353
export PATH; PATH="`pwd`:$$PATH"; \
13431354
export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
13441355
export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
13451356
export EXE; EXE="$(BUILDEXE)"; \
1357+
export CC; CC="$(CC)"; \
13461358
if [ -n "$(MULTIARCH)" ]; then export MULTIARCH; MULTIARCH=$(MULTIARCH); fi; \
13471359
export PYTHON_FOR_BUILD; \
13481360
if [ "$(BUILD_GNU_TYPE)" = "$(HOST_GNU_TYPE)" ]; then \
13491361
PYTHON_FOR_BUILD="$(BUILDPYTHON)"; \
13501362
else \
13511363
PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)"; \
13521364
fi; \
1365+
export H2PY; H2PY="$$PYTHON_FOR_BUILD $(abs_srcdir)/Tools/scripts/h2py.py"; \
13531366
cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
13541367

13551368
python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
@@ -1448,7 +1461,7 @@ sharedinstall: sharedmods
14481461
--install-scripts=$(BINDIR) \
14491462
--install-platlib=$(DESTSHARED) \
14501463
--root=$(DESTDIR)/
1451-
-rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py
1464+
-rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS).py
14521465
-rm -r $(DESTDIR)$(DESTSHARED)/__pycache__
14531466

14541467
# Here are a couple of targets for MacOSX again, to install a full
@@ -1627,6 +1640,9 @@ clobber: clean profile-removal
16271640
-rm -rf build platform
16281641
-rm -rf $(PYTHONFRAMEWORKDIR)
16291642
-rm -f python-config.py python-config
1643+
if [ -n "$(MULTIARCH)" ]; then \
1644+
rm -rf $(srcdir)/Lib/$(PLATDIR); \
1645+
fi
16301646

16311647
# Make things extra clean, before making a distribution:
16321648
# remove all generated files, even Makefile[.pre]

Misc/NEWS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ IDLE
2525

2626
- Issue #27310: Fix IDLE.app failure to launch on OS X due to vestigial import.
2727

28+
Build
29+
-----
30+
31+
- Issue #23968: Rename the platform directory from plat-$(MACHDEP) to
32+
plat-$(PLATFORM_TRIPLET).
33+
Rename the config directory (LIBPL) from config-$(LDVERSION) to
34+
config-$(LDVERSION)-$(PLATFORM_TRIPLET).
35+
Install the platform specifc _sysconfigdata module into the platform
36+
directory and rename it to include the ABIFLAGS.
37+
2838

2939
What's New in Python 3.6.0 alpha 2
3040
==================================

Python/sysmodule.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,6 +1693,16 @@ make_impl_info(PyObject *version_info)
16931693
if (res < 0)
16941694
goto error;
16951695

1696+
#ifdef MULTIARCH
1697+
value = PyUnicode_FromString(MULTIARCH);
1698+
if (value == NULL)
1699+
goto error;
1700+
res = PyDict_SetItemString(impl_info, "_multiarch", value);
1701+
Py_DECREF(value);
1702+
if (res < 0)
1703+
goto error;
1704+
#endif
1705+
16961706
/* dict ready */
16971707

16981708
ns = _PyNamespace_New(impl_info);

configure

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ LIBRARY
704704
BUILDEXEEXT
705705
EGREP
706706
NO_AS_NEEDED
707+
MULTIARCH_CPPFLAGS
707708
PLATFORM_TRIPLET
708709
PLATDIR
709710
MULTIARCH
@@ -776,6 +777,7 @@ infodir
776777
docdir
777778
oldincludedir
778779
includedir
780+
runstatedir
779781
localstatedir
780782
sharedstatedir
781783
sysconfdir
@@ -886,6 +888,7 @@ datadir='${datarootdir}'
886888
sysconfdir='${prefix}/etc'
887889
sharedstatedir='${prefix}/com'
888890
localstatedir='${prefix}/var'
891+
runstatedir='${localstatedir}/run'
889892
includedir='${prefix}/include'
890893
oldincludedir='/usr/include'
891894
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1138,6 +1141,15 @@ do
11381141
| -silent | --silent | --silen | --sile | --sil)
11391142
silent=yes ;;
11401143

1144+
-runstatedir | --runstatedir | --runstatedi | --runstated \
1145+
| --runstate | --runstat | --runsta | --runst | --runs \
1146+
| --run | --ru | --r)
1147+
ac_prev=runstatedir ;;
1148+
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
1149+
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
1150+
| --run=* | --ru=* | --r=*)
1151+
runstatedir=$ac_optarg ;;
1152+
11411153
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
11421154
ac_prev=sbindir ;;
11431155
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1275,7 +1287,7 @@ fi
12751287
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
12761288
datadir sysconfdir sharedstatedir localstatedir includedir \
12771289
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1278-
libdir localedir mandir
1290+
libdir localedir mandir runstatedir
12791291
do
12801292
eval ac_val=\$$ac_var
12811293
# Remove trailing slashes.
@@ -1428,6 +1440,7 @@ Fine tuning of the installation directories:
14281440
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
14291441
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
14301442
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
1443+
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
14311444
--libdir=DIR object code libraries [EPREFIX/lib]
14321445
--includedir=DIR C header files [PREFIX/include]
14331446
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -2877,6 +2890,7 @@ ac_config_headers="$ac_config_headers pyconfig.h"
28772890

28782891

28792892

2893+
28802894
ac_aux_dir=
28812895
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
28822896
if test -f "$ac_dir/install-sh"; then
@@ -5332,9 +5346,16 @@ if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
53325346
as_fn_error $? "internal configure error for the platform triplet, please file a bug report" "$LINENO" 5
53335347
fi
53345348
fi
5335-
PLATDIR=plat-$MACHDEP
5349+
if test x$PLATFORM_TRIPLET = x; then
5350+
PLATDIR=plat-$MACHDEP
5351+
else
5352+
PLATDIR=plat-$PLATFORM_TRIPLET
5353+
fi
53365354

53375355

5356+
if test x$MULTIARCH != x; then
5357+
MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\""
5358+
fi
53385359

53395360

53405361
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wl,--no-as-needed" >&5
@@ -14768,7 +14789,11 @@ LDVERSION='$(VERSION)$(ABIFLAGS)'
1476814789
$as_echo "$LDVERSION" >&6; }
1476914790

1477014791

14771-
LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
14792+
if test x$PLATFORM_TRIPLET = x; then
14793+
LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
14794+
else
14795+
LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
14796+
fi
1477214797

1477314798

1477414799
# Check whether right shifting a negative integer extends the sign bit

configure.ac

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -872,10 +872,17 @@ if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
872872
AC_MSG_ERROR([internal configure error for the platform triplet, please file a bug report])
873873
fi
874874
fi
875-
PLATDIR=plat-$MACHDEP
875+
if test x$PLATFORM_TRIPLET = x; then
876+
PLATDIR=plat-$MACHDEP
877+
else
878+
PLATDIR=plat-$PLATFORM_TRIPLET
879+
fi
876880
AC_SUBST(PLATDIR)
877881
AC_SUBST(PLATFORM_TRIPLET)
878-
882+
if test x$MULTIARCH != x; then
883+
MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\""
884+
fi
885+
AC_SUBST(MULTIARCH_CPPFLAGS)
879886

880887
AC_MSG_CHECKING([for -Wl,--no-as-needed])
881888
save_LDFLAGS="$LDFLAGS"
@@ -4462,7 +4469,11 @@ AC_MSG_RESULT($LDVERSION)
44624469

44634470
dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
44644471
AC_SUBST(PY_ENABLE_SHARED)
4465-
LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
4472+
if test x$PLATFORM_TRIPLET = x; then
4473+
LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
4474+
else
4475+
LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
4476+
fi
44664477
AC_SUBST(LIBPL)
44674478

44684479
# Check whether right shifting a negative integer extends the sign bit

0 commit comments

Comments
 (0)