Issue #28046: Remove platform-specific directories from sys.path
This commit is contained in:
parent
b44acebc7b
commit
c4b53afce4
|
@ -21,7 +21,6 @@ Doc/venv/
|
||||||
Lib/distutils/command/*.pdb
|
Lib/distutils/command/*.pdb
|
||||||
Lib/lib2to3/*.pickle
|
Lib/lib2to3/*.pickle
|
||||||
Lib/test/data/*
|
Lib/test/data/*
|
||||||
Lib/plat-mac/errors.rsrc.df.rsrc
|
|
||||||
Makefile
|
Makefile
|
||||||
Makefile.pre
|
Makefile.pre
|
||||||
Misc/python.pc
|
Misc/python.pc
|
||||||
|
|
|
@ -26,7 +26,6 @@ python-config$
|
||||||
python-config.py$
|
python-config.py$
|
||||||
reflog.txt$
|
reflog.txt$
|
||||||
tags$
|
tags$
|
||||||
Lib/plat-mac/errors.rsrc.df.rsrc
|
|
||||||
Misc/python.pc
|
Misc/python.pc
|
||||||
Misc/python-config.sh$
|
Misc/python-config.sh$
|
||||||
Modules/Setup$
|
Modules/Setup$
|
||||||
|
|
|
@ -341,6 +341,15 @@ def get_makefile_filename():
|
||||||
config_dir_name += '-%s' % sys.implementation._multiarch
|
config_dir_name += '-%s' % sys.implementation._multiarch
|
||||||
return os.path.join(get_path('stdlib'), config_dir_name, 'Makefile')
|
return os.path.join(get_path('stdlib'), config_dir_name, 'Makefile')
|
||||||
|
|
||||||
|
|
||||||
|
def _get_sysconfigdata_name():
|
||||||
|
return '_sysconfigdata_{abi}_{platform}_{multiarch}'.format(
|
||||||
|
abi=sys.abiflags,
|
||||||
|
platform=sys.platform,
|
||||||
|
multiarch=getattr(sys.implementation, '_multiarch', ''),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _generate_posix_vars():
|
def _generate_posix_vars():
|
||||||
"""Generate the Python module containing build-time variables."""
|
"""Generate the Python module containing build-time variables."""
|
||||||
import pprint
|
import pprint
|
||||||
|
@ -381,7 +390,7 @@ def _generate_posix_vars():
|
||||||
# _sysconfigdata module manually and populate it with the build vars.
|
# _sysconfigdata module manually and populate it with the build vars.
|
||||||
# This is more than sufficient for ensuring the subsequent call to
|
# This is more than sufficient for ensuring the subsequent call to
|
||||||
# get_platform() succeeds.
|
# get_platform() succeeds.
|
||||||
name = '_sysconfigdata_' + sys.abiflags
|
name = _get_sysconfigdata_name()
|
||||||
if 'darwin' in sys.platform:
|
if 'darwin' in sys.platform:
|
||||||
import types
|
import types
|
||||||
module = types.ModuleType(name)
|
module = types.ModuleType(name)
|
||||||
|
@ -407,7 +416,7 @@ def _generate_posix_vars():
|
||||||
def _init_posix(vars):
|
def _init_posix(vars):
|
||||||
"""Initialize the module as appropriate for POSIX systems."""
|
"""Initialize the module as appropriate for POSIX systems."""
|
||||||
# _sysconfigdata is generated at build time, see _generate_posix_vars()
|
# _sysconfigdata is generated at build time, see _generate_posix_vars()
|
||||||
name = '_sysconfigdata_' + sys.abiflags
|
name = _get_sysconfigdata_name()
|
||||||
_temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
|
_temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
|
||||||
build_time_vars = _temp.build_time_vars
|
build_time_vars = _temp.build_time_vars
|
||||||
vars.update(build_time_vars)
|
vars.update(build_time_vars)
|
||||||
|
|
|
@ -1292,7 +1292,8 @@ def buildPython():
|
||||||
|
|
||||||
import pprint
|
import pprint
|
||||||
if getVersionMajorMinor() >= (3, 6):
|
if getVersionMajorMinor() >= (3, 6):
|
||||||
path = os.path.join(path_to_lib, 'plat-darwin', '_sysconfigdata_m.py')
|
# XXX this is extra-fragile
|
||||||
|
path = os.path.join(path_to_lib, '_sysconfigdata_m_darwin_darwin.py')
|
||||||
else:
|
else:
|
||||||
path = os.path.join(path_to_lib, '_sysconfigdata.py')
|
path = os.path.join(path_to_lib, '_sysconfigdata.py')
|
||||||
fp = open(path, 'r')
|
fp = open(path, 'r')
|
||||||
|
|
|
@ -1178,8 +1178,6 @@ maninstall: altmaninstall
|
||||||
(cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python$(VERSION).1 python3.1)
|
(cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python$(VERSION).1 python3.1)
|
||||||
|
|
||||||
# Install the library
|
# Install the library
|
||||||
PLATDIR= @PLATDIR@
|
|
||||||
MACHDEPS= $(PLATDIR)
|
|
||||||
XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
|
XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
|
||||||
LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
|
LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
|
||||||
tkinter/test/test_ttk site-packages test \
|
tkinter/test/test_ttk site-packages test \
|
||||||
|
@ -1238,8 +1236,8 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
|
||||||
multiprocessing multiprocessing/dummy \
|
multiprocessing multiprocessing/dummy \
|
||||||
unittest unittest/test unittest/test/testmock \
|
unittest unittest/test unittest/test/testmock \
|
||||||
venv venv/scripts venv/scripts/posix \
|
venv venv/scripts venv/scripts/posix \
|
||||||
curses pydoc_data $(MACHDEPS)
|
curses pydoc_data
|
||||||
libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
|
libinstall: build_all $(srcdir)/Modules/xxmodule.c
|
||||||
@for i in $(SCRIPTDIR) $(LIBDEST); \
|
@for i in $(SCRIPTDIR) $(LIBDEST); \
|
||||||
do \
|
do \
|
||||||
if test ! -d $(DESTDIR)$$i; then \
|
if test ! -d $(DESTDIR)$$i; then \
|
||||||
|
@ -1294,10 +1292,10 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
|
||||||
esac; \
|
esac; \
|
||||||
done; \
|
done; \
|
||||||
done
|
done
|
||||||
$(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS).py \
|
$(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py \
|
||||||
$(DESTDIR)$(LIBDEST)/$(PLATDIR); \
|
$(DESTDIR)$(LIBDEST); \
|
||||||
echo $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS).py \
|
echo $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS).py \
|
||||||
$(LIBDEST)/$(PLATDIR)
|
$(LIBDEST)
|
||||||
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
|
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
|
||||||
if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
|
if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
|
||||||
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
|
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
|
||||||
|
@ -1335,9 +1333,6 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
|
||||||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
||||||
$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
|
$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
|
||||||
|
|
||||||
$(srcdir)/Lib/$(PLATDIR):
|
|
||||||
mkdir $(srcdir)/Lib/$(PLATDIR)
|
|
||||||
|
|
||||||
python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
|
python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
|
||||||
# Substitution happens here, as the completely-expanded BINDIR
|
# Substitution happens here, as the completely-expanded BINDIR
|
||||||
# is not available in configure
|
# is not available in configure
|
||||||
|
@ -1614,9 +1609,6 @@ clobber: clean profile-removal
|
||||||
-rm -rf build platform
|
-rm -rf build platform
|
||||||
-rm -rf $(PYTHONFRAMEWORKDIR)
|
-rm -rf $(PYTHONFRAMEWORKDIR)
|
||||||
-rm -f python-config.py python-config
|
-rm -f python-config.py python-config
|
||||||
if [ -n "$(MULTIARCH)" ]; then \
|
|
||||||
rm -rf $(srcdir)/Lib/$(PLATDIR); \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make things extra clean, before making a distribution:
|
# Make things extra clean, before making a distribution:
|
||||||
# remove all generated files, even Makefile[.pre]
|
# remove all generated files, even Makefile[.pre]
|
||||||
|
|
|
@ -10,6 +10,8 @@ What's New in Python 3.6.0 beta 1
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #28046: Remove platform-specific directories from sys.path.
|
||||||
|
|
||||||
- Issue #25758: Prevents zipimport from unnecessarily encoding a filename
|
- Issue #25758: Prevents zipimport from unnecessarily encoding a filename
|
||||||
(patch by Eryk Sun)
|
(patch by Eryk Sun)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
is set, we believe it. Otherwise, we use the path of our host .EXE's
|
is set, we believe it. Otherwise, we use the path of our host .EXE's
|
||||||
to try and locate on of our "landmarks" and deduce our home.
|
to try and locate on of our "landmarks" and deduce our home.
|
||||||
- If we DO have a Python Home: The relevant sub-directories (Lib,
|
- If we DO have a Python Home: The relevant sub-directories (Lib,
|
||||||
plat-win, etc) are based on the Python Home
|
DLLs, etc) are based on the Python Home
|
||||||
- If we DO NOT have a Python Home, the core Python Path is
|
- If we DO NOT have a Python Home, the core Python Path is
|
||||||
loaded from the registry. This is the main PythonPath key,
|
loaded from the registry. This is the main PythonPath key,
|
||||||
and both HKLM and HKCU are combined to form the path)
|
and both HKLM and HKCU are combined to form the path)
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
* Iff - we can not locate the Python Home, have not had a PYTHONPATH
|
* Iff - we can not locate the Python Home, have not had a PYTHONPATH
|
||||||
specified, and can't locate any Registry entries (ie, we have _nothing_
|
specified, and can't locate any Registry entries (ie, we have _nothing_
|
||||||
we can assume is a good path), a default path with relative entries is
|
we can assume is a good path), a default path with relative entries is
|
||||||
used (eg. .\Lib;.\plat-win, etc)
|
used (eg. .\Lib;.\DLLs, etc)
|
||||||
|
|
||||||
|
|
||||||
If a sys.path file exists adjacent to python.exe, it must contain a
|
If a sys.path file exists adjacent to python.exe, it must contain a
|
||||||
|
|
|
@ -67,8 +67,6 @@ def include_in_lib(p):
|
||||||
if p.is_dir():
|
if p.is_dir():
|
||||||
if name in EXCLUDE_FROM_LIBRARY:
|
if name in EXCLUDE_FROM_LIBRARY:
|
||||||
return False
|
return False
|
||||||
if name.startswith('plat-'):
|
|
||||||
return False
|
|
||||||
if name == 'test' and p.parts[-2].lower() == 'lib':
|
if name == 'test' and p.parts[-2].lower() == 'lib':
|
||||||
return False
|
return False
|
||||||
if name in {'test', 'tests'} and p.parts[-3].lower() == 'lib':
|
if name in {'test', 'tests'} and p.parts[-3].lower() == 'lib':
|
||||||
|
|
|
@ -712,7 +712,6 @@ EGREP
|
||||||
NO_AS_NEEDED
|
NO_AS_NEEDED
|
||||||
MULTIARCH_CPPFLAGS
|
MULTIARCH_CPPFLAGS
|
||||||
PLATFORM_TRIPLET
|
PLATFORM_TRIPLET
|
||||||
PLATDIR
|
|
||||||
MULTIARCH
|
MULTIARCH
|
||||||
ac_ct_CXX
|
ac_ct_CXX
|
||||||
MAINCC
|
MAINCC
|
||||||
|
@ -2929,7 +2928,7 @@ $as_echo_n "checking for python interpreter for cross build... " >&6; }
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5
|
||||||
$as_echo "$interp" >&6; }
|
$as_echo "$interp" >&6; }
|
||||||
PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
|
PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib '$interp
|
||||||
fi
|
fi
|
||||||
# Used to comment out stuff for rebuilding generated files
|
# Used to comment out stuff for rebuilding generated files
|
||||||
GENERATED_COMMENT='#'
|
GENERATED_COMMENT='#'
|
||||||
|
@ -5361,12 +5360,6 @@ if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
|
||||||
elif test x$PLATFORM_TRIPLET != x && test x$MULTIARCH = x; then
|
elif test x$PLATFORM_TRIPLET != x && test x$MULTIARCH = x; then
|
||||||
MULTIARCH=$PLATFORM_TRIPLET
|
MULTIARCH=$PLATFORM_TRIPLET
|
||||||
fi
|
fi
|
||||||
if test x$PLATFORM_TRIPLET = x; then
|
|
||||||
PLATDIR=plat-$MACHDEP
|
|
||||||
else
|
|
||||||
PLATDIR=plat-$PLATFORM_TRIPLET
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if test x$MULTIARCH != x; then
|
if test x$MULTIARCH != x; then
|
||||||
MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\""
|
MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\""
|
||||||
|
|
|
@ -78,7 +78,7 @@ if test "$cross_compiling" = yes; then
|
||||||
AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
|
AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT($interp)
|
AC_MSG_RESULT($interp)
|
||||||
PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
|
PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib '$interp
|
||||||
fi
|
fi
|
||||||
# Used to comment out stuff for rebuilding generated files
|
# Used to comment out stuff for rebuilding generated files
|
||||||
GENERATED_COMMENT='#'
|
GENERATED_COMMENT='#'
|
||||||
|
@ -910,12 +910,6 @@ if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
|
||||||
elif test x$PLATFORM_TRIPLET != x && test x$MULTIARCH = x; then
|
elif test x$PLATFORM_TRIPLET != x && test x$MULTIARCH = x; then
|
||||||
MULTIARCH=$PLATFORM_TRIPLET
|
MULTIARCH=$PLATFORM_TRIPLET
|
||||||
fi
|
fi
|
||||||
if test x$PLATFORM_TRIPLET = x; then
|
|
||||||
PLATDIR=plat-$MACHDEP
|
|
||||||
else
|
|
||||||
PLATDIR=plat-$PLATFORM_TRIPLET
|
|
||||||
fi
|
|
||||||
AC_SUBST(PLATDIR)
|
|
||||||
AC_SUBST(PLATFORM_TRIPLET)
|
AC_SUBST(PLATFORM_TRIPLET)
|
||||||
if test x$MULTIARCH != x; then
|
if test x$MULTIARCH != x; then
|
||||||
MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\""
|
MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\""
|
||||||
|
|
Loading…
Reference in New Issue