Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9e82b17

Browse files
committed
Issue #21711: support for "site-python" directories has now been removed from the site module (it was deprecated in 3.4).
1 parent b6cf631 commit 9e82b17

4 files changed

Lines changed: 19 additions & 27 deletions

File tree

Doc/library/site.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,23 @@ additions, call the :func:`site.main` function.
2626
:option:`-S`.
2727

2828
.. index::
29-
pair: site-python; directory
3029
pair: site-packages; directory
3130

3231
It starts by constructing up to four directories from a head and a tail part.
3332
For the head part, it uses ``sys.prefix`` and ``sys.exec_prefix``; empty heads
3433
are skipped. For the tail part, it uses the empty string and then
3534
:file:`lib/site-packages` (on Windows) or
36-
:file:`lib/python{X.Y}/site-packages` and then :file:`lib/site-python` (on
37-
Unix and Macintosh). For each of the distinct head-tail combinations, it sees
38-
if it refers to an existing directory, and if so, adds it to ``sys.path`` and
39-
also inspects the newly added path for configuration files.
35+
:file:`lib/python{X.Y}/site-packages` (on Unix and Macintosh). For each
36+
of the distinct head-tail combinations, it sees if it refers to an existing
37+
directory, and if so, adds it to ``sys.path`` and also inspects the newly
38+
added path for configuration files.
4039

41-
.. deprecated-removed:: 3.4 3.5
42-
Support for the "site-python" directory will be removed in 3.5.
40+
.. versionchanged:: 3.5
41+
Support for the "site-python" directory has been removed.
4342

4443
If a file named "pyvenv.cfg" exists one directory above sys.executable,
4544
sys.prefix and sys.exec_prefix are set to that directory and
46-
it is also checked for site-packages and site-python (sys.base_prefix and
45+
it is also checked for site-packages (sys.base_prefix and
4746
sys.base_exec_prefix will always be the "real" prefixes of the Python
4847
installation). If "pyvenv.cfg" (a bootstrap configuration file) contains
4948
the key "include-system-site-packages" set to anything other than "false"
@@ -195,8 +194,7 @@ Module contents
195194

196195
.. function:: getsitepackages()
197196

198-
Return a list containing all global site-packages directories (and possibly
199-
site-python).
197+
Return a list containing all global site-packages directories.
200198

201199
.. versionadded:: 3.2
202200

Lib/site.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
This will append site-specific paths to the module search path. On
88
Unix (including Mac OSX), it starts with sys.prefix and
99
sys.exec_prefix (if different) and appends
10-
lib/python<version>/site-packages as well as lib/site-python.
10+
lib/python<version>/site-packages.
1111
On other platforms (such as Windows), it tries each of the
1212
prefixes directly, as well as with lib/site-packages appended. The
1313
resulting directories, if they exist, are appended to sys.path, and
1414
also inspected for path configuration files.
1515
1616
If a file named "pyvenv.cfg" exists one directory above sys.executable,
1717
sys.prefix and sys.exec_prefix are set to that directory and
18-
it is also checked for site-packages and site-python (sys.base_prefix and
18+
it is also checked for site-packages (sys.base_prefix and
1919
sys.base_exec_prefix will always be the "real" prefixes of the Python
2020
installation). If "pyvenv.cfg" (a bootstrap configuration file) contains
2121
the key "include-system-site-packages" set to anything other than "false"
@@ -285,8 +285,7 @@ def addusersitepackages(known_paths):
285285
return known_paths
286286

287287
def getsitepackages(prefixes=None):
288-
"""Returns a list containing all global site-packages directories
289-
(and possibly site-python).
288+
"""Returns a list containing all global site-packages directories.
290289
291290
For each directory present in ``prefixes`` (or the global ``PREFIXES``),
292291
this function will find its `site-packages` subdirectory depending on the
@@ -307,7 +306,6 @@ def getsitepackages(prefixes=None):
307306
sitepackages.append(os.path.join(prefix, "lib",
308307
"python" + sys.version[:3],
309308
"site-packages"))
310-
sitepackages.append(os.path.join(prefix, "lib", "site-python"))
311309
else:
312310
sitepackages.append(prefix)
313311
sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
@@ -323,14 +321,9 @@ def getsitepackages(prefixes=None):
323321
return sitepackages
324322

325323
def addsitepackages(known_paths, prefixes=None):
326-
"""Add site-packages (and possibly site-python) to sys.path"""
324+
"""Add site-packages to sys.path"""
327325
for sitedir in getsitepackages(prefixes):
328326
if os.path.isdir(sitedir):
329-
if "site-python" in sitedir:
330-
import warnings
331-
warnings.warn('"site-python" directories will not be '
332-
'supported in 3.5 anymore',
333-
DeprecationWarning)
334327
addsitedir(sitedir, known_paths)
335328

336329
return known_paths

Lib/test/test_site.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,20 +235,18 @@ def test_getsitepackages(self):
235235
# OS X framework builds
236236
site.PREFIXES = ['Python.framework']
237237
dirs = site.getsitepackages()
238-
self.assertEqual(len(dirs), 3)
238+
self.assertEqual(len(dirs), 2)
239239
wanted = os.path.join('/Library',
240240
sysconfig.get_config_var("PYTHONFRAMEWORK"),
241241
sys.version[:3],
242242
'site-packages')
243-
self.assertEqual(dirs[2], wanted)
243+
self.assertEqual(dirs[1], wanted)
244244
elif os.sep == '/':
245245
# OS X non-framwework builds, Linux, FreeBSD, etc
246-
self.assertEqual(len(dirs), 2)
246+
self.assertEqual(len(dirs), 1)
247247
wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
248248
'site-packages')
249249
self.assertEqual(dirs[0], wanted)
250-
wanted = os.path.join('xoxo', 'lib', 'site-python')
251-
self.assertEqual(dirs[1], wanted)
252250
else:
253251
# other platforms
254252
self.assertEqual(len(dirs), 2)

Misc/NEWS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ Core and Builtins
9292
Library
9393
-------
9494

95-
- Issue 17552: new socket.sendfile() method allowing to send a file over a
95+
- Issue #21711: support for "site-python" directories has now been removed
96+
from the site module (it was deprecated in 3.4).
97+
98+
- Issue #17552: new socket.sendfile() method allowing to send a file over a
9699
socket by using high-performance os.sendfile() on UNIX.
97100
Patch by Giampaolo Rodola'.
98101

0 commit comments

Comments
 (0)