[Python-checkins] cpython: Issue #19375: The site module adding a "site-python" directory to sys.path, if

antoine.pitrou python-checkins at python.org
Fri Oct 25 21:40:03 CEST 2013


http://hg.python.org/cpython/rev/90c56229efb7
changeset:   86634:90c56229efb7
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Fri Oct 25 21:39:26 2013 +0200
summary:
  Issue #19375: The site module adding a "site-python" directory to sys.path, if it exists, is now deprecated.

files:
  Doc/library/site.rst |  3 +++
  Doc/whatsnew/3.4.rst |  3 ++-
  Lib/site.py          |  5 +++++
  Misc/NEWS            |  3 +++
  4 files changed, 13 insertions(+), 1 deletions(-)


diff --git a/Doc/library/site.rst b/Doc/library/site.rst
--- a/Doc/library/site.rst
+++ b/Doc/library/site.rst
@@ -38,6 +38,9 @@
 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
diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -685,7 +685,8 @@
 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
diff --git a/Lib/site.py b/Lib/site.py
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -326,6 +326,11 @@
     """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
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,9 @@
 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.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list