]> granicus.if.org Git - python/commitdiff
Issue #19375: The site module adding a "site-python" directory to sys.path, if it...
authorAntoine Pitrou <solipsis@pitrou.net>
Fri, 25 Oct 2013 19:39:26 +0000 (21:39 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Fri, 25 Oct 2013 19:39:26 +0000 (21:39 +0200)
Doc/library/site.rst
Doc/whatsnew/3.4.rst
Lib/site.py
Misc/NEWS

index 2175c3e2e74e569df3bd95ef2675dcd9eb2efbf6..d93e938b5c90dfbb352fb47c64323c9b9f28c055 100644 (file)
@@ -38,6 +38,9 @@ Unix and Macintosh).  For each of the distinct head-tail combinations, it sees
 if it refers to an existing directory, and if so, adds it to ``sys.path`` and
 also inspects the newly added path for configuration files.
 
+.. deprecated:: 3.4
+   Support for the "site-python" directory will be removed in 3.5.
+
 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
index 392af3b3c577a40f999bb0212fd9d1d0011f3a7e..6e261d5913d19240fb7f69c3950391412635fb80 100644 (file)
@@ -685,7 +685,8 @@ Deprecated functions and types of the C API
 Deprecated features
 -------------------
 
-* No feature deprecations are planned for Python 3.4.
+* The site module adding a "site-python" directory to sys.path, if it
+  exists, is deprecated (:issue:`19375`).
 
 
 Porting to Python 3.4
index bb329b438120f0057b8b9952472b03711f4a5a03..b0d8268f8165435398d71cee018e14795b55c53b 100644 (file)
@@ -326,6 +326,11 @@ def addsitepackages(known_paths, prefixes=None):
     """Add site-packages (and possibly site-python) 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
index 5f6ccad7521cccf343e2b7aca7f8c6c112c36cbf..be64bee591df63e549d684b6beeea37fe9f4df48 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #19375: The site module adding a "site-python" directory to sys.path,
+  if it exists, is now deprecated.
+
 - Issue #19379: Lazily import linecache in the warnings module, to make
   startup with warnings faster until a warning gets printed.