summaryrefslogtreecommitdiff
path: root/setuptools/_distutils/sysconfig.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-07-08 20:42:40 -0400
committerJason R. Coombs <jaraco@jaraco.com>2020-07-08 20:42:40 -0400
commitcafc9f4d3a840f16dcaf096a76f0a7965ad264bf (patch)
tree19b09c7fdb7e061a244319e6744ef561d9973ef2 /setuptools/_distutils/sysconfig.py
parentec410c356578b5c51aec9a76b2f1de38f788b167 (diff)
parent9ec01c3a48fa9ae5c188ec5a8d9c77f06df47d09 (diff)
downloadpython-setuptools-git-bugfix/2232-ubuntu-patch.tar.gz
Merge https://github.com/pypa/distutils into bugfix/2232-ubuntu-patchbugfix/2232-ubuntu-patch
Diffstat (limited to 'setuptools/_distutils/sysconfig.py')
-rw-r--r--setuptools/_distutils/sysconfig.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/setuptools/_distutils/sysconfig.py b/setuptools/_distutils/sysconfig.py
index 879b6981..8e42b7b8 100644
--- a/setuptools/_distutils/sysconfig.py
+++ b/setuptools/_distutils/sysconfig.py
@@ -150,6 +150,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
return os.path.join(prefix, "lib-python", sys.version[0])
return os.path.join(prefix, 'site-packages')
+ is_default_prefix = not prefix or os.path.normpath(prefix) in ('/usr', '/usr/local')
if prefix is None:
if standard_lib:
prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
@@ -168,6 +169,12 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
"python" + get_python_version())
if standard_lib:
return libpython
+ elif (is_default_prefix and
+ 'PYTHONUSERBASE' not in os.environ and
+ 'VIRTUAL_ENV' not in os.environ and
+ 'real_prefix' not in sys.__dict__ and
+ sys.prefix == sys.base_prefix):
+ return os.path.join(prefix, "lib", "python3", "dist-packages")
else:
return os.path.join(libpython, "site-packages")
elif os.name == "nt":