summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-10-25 19:39:26 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-10-25 19:39:26 (GMT)
commit3b2f0f045903ba9f24d92c053bd6d0fc8561973f (patch)
treed3bcca7df65ba9eab3136f66dd93b875cda70c54
parent79aa68dfc1ab4936107f9528d939e865f94da4b6 (diff)
downloadcpython-3b2f0f045903ba9f24d92c053bd6d0fc8561973f.zip
cpython-3b2f0f045903ba9f24d92c053bd6d0fc8561973f.tar.gz
cpython-3b2f0f045903ba9f24d92c053bd6d0fc8561973f.tar.bz2
Issue #19375: The site module adding a "site-python" directory to sys.path, if it exists, is now deprecated.
-rw-r--r--Doc/library/site.rst3
-rw-r--r--Doc/whatsnew/3.4.rst3
-rw-r--r--Lib/site.py5
-rw-r--r--Misc/NEWS3
4 files changed, 13 insertions, 1 deletions
diff --git a/Doc/library/site.rst b/Doc/library/site.rst
index 2175c3e..d93e938 100644
--- a/Doc/library/site.rst
+++ b/Doc/library/site.rst
@@ -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
diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
index 392af3b..6e261d5 100644
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -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
diff --git a/Lib/site.py b/Lib/site.py
index bb329b4..b0d8268 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -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
diff --git a/Misc/NEWS b/Misc/NEWS
index 5f6ccad..be64bee 100644
--- 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.