diff options
Diffstat (limited to 'Lib/site.py')
-rw-r--r-- | Lib/site.py | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/Lib/site.py b/Lib/site.py index ad5d136ac0..b7d0331fa7 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -7,7 +7,7 @@ This will append site-specific paths to the module search path. On Unix (including Mac OSX), it starts with sys.prefix and sys.exec_prefix (if different) and appends -lib/python<version>/site-packages as well as lib/site-python. +lib/python<version>/site-packages. On other platforms (such as Windows), it tries each of the prefixes directly, as well as with lib/site-packages appended. The resulting directories, if they exist, are appended to sys.path, and @@ -15,7 +15,7 @@ also inspected for path configuration files. If a file named "pyvenv.cfg" exists one directory above sys.executable, sys.prefix and sys.exec_prefix are set to that directory and -it is also checked for site-packages and site-python (sys.base_prefix and +it is also checked for site-packages (sys.base_prefix and sys.base_exec_prefix will always be the "real" prefixes of the Python installation). If "pyvenv.cfg" (a bootstrap configuration file) contains the key "include-system-site-packages" set to anything other than "false" @@ -98,8 +98,8 @@ def makepath(*paths): def abs_paths(): """Set all module __file__ and __cached__ attributes to an absolute path""" for m in set(sys.modules.values()): - if (getattr(getattr(m, '__loader__', None), '__module__', None) != - '_frozen_importlib'): + if (getattr(getattr(m, '__loader__', None), '__module__', None) not in + ('_frozen_importlib', '_frozen_importlib_external')): continue # don't mess with a PEP 302-supplied __file__ try: m.__file__ = os.path.abspath(m.__file__) @@ -285,8 +285,7 @@ def addusersitepackages(known_paths): return known_paths def getsitepackages(prefixes=None): - """Returns a list containing all global site-packages directories - (and possibly site-python). + """Returns a list containing all global site-packages directories. For each directory present in ``prefixes`` (or the global ``PREFIXES``), this function will find its `site-packages` subdirectory depending on the @@ -307,7 +306,6 @@ def getsitepackages(prefixes=None): sitepackages.append(os.path.join(prefix, "lib", "python" + sys.version[:3], "site-packages")) - sitepackages.append(os.path.join(prefix, "lib", "site-python")) else: sitepackages.append(prefix) sitepackages.append(os.path.join(prefix, "lib", "site-packages")) @@ -323,14 +321,9 @@ def getsitepackages(prefixes=None): return sitepackages def addsitepackages(known_paths, prefixes=None): - """Add site-packages (and possibly site-python) to sys.path""" + """Add site-packages to sys.path""" for sitedir in getsitepackages(prefixes): if os.path.isdir(sitedir): - if "site-python" in sitedir: - import warnings - warnings.warn('"site-python" directories will not be ' - 'supported in 3.5 anymore', - DeprecationWarning) addsitedir(sitedir, known_paths) return known_paths |