diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2010-01-29 11:41:03 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2010-01-29 11:41:03 (GMT) |
commit | edacea30e457e151611a9fe560120cedb3bdc527 (patch) | |
tree | 3227e5e1c060cce48b00d34b9ae46571f079e2fb /Lib/site.py | |
parent | 82b83985832a0b1922aa86261f764b12a7237ac5 (diff) | |
download | cpython-edacea30e457e151611a9fe560120cedb3bdc527.zip cpython-edacea30e457e151611a9fe560120cedb3bdc527.tar.gz cpython-edacea30e457e151611a9fe560120cedb3bdc527.tar.bz2 |
Merged revisions 77704,77752 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77704 | tarek.ziade | 2010-01-23 10:23:15 +0100 (Sat, 23 Jan 2010) | 1 line
taking sysconfig out of distutils
........
r77752 | tarek.ziade | 2010-01-26 00:19:56 +0100 (Tue, 26 Jan 2010) | 1 line
switched the call order so this call works without suffering from issue #7774
........
Diffstat (limited to 'Lib/site.py')
-rw-r--r-- | Lib/site.py | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/Lib/site.py b/Lib/site.py index 3d455e7..bf4d67f 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -108,7 +108,7 @@ def removeduppaths(): def addbuilddir(): """Append ./build/lib.<platform> in case we're running in the build dir (especially for Guido :-)""" - from distutils.util import get_platform + from sysconfig import get_platform s = "build/lib.%s-%.3s" % (get_platform(), sys.version) if hasattr(sys, 'gettotalrefcount'): s += '-pydebug' @@ -218,19 +218,8 @@ def getuserbase(): global USER_BASE if USER_BASE is not None: return USER_BASE - - env_base = os.environ.get("PYTHONUSERBASE", None) - - def joinuser(*args): - return os.path.expanduser(os.path.join(*args)) - - # what about 'os2emx', 'riscos' ? - if os.name == "nt": - base = os.environ.get("APPDATA") or "~" - USER_BASE = env_base if env_base else joinuser(base, "Python") - else: - USER_BASE = env_base if env_base else joinuser("~", ".local") - + from sysconfig import get_config_var + USER_BASE = get_config_var('userbase') return USER_BASE def getusersitepackages(): @@ -245,13 +234,9 @@ def getusersitepackages(): if USER_SITE is not None: return USER_SITE - if os.name == "nt": - USER_SITE = os.path.join(user_base, "Python" + sys.version[0] + - sys.version[2], "site-packages") - else: - USER_SITE = os.path.join(user_base, "lib", "python" + sys.version[:3], - "site-packages") - + from sysconfig import get_path + import os + USER_SITE = get_path('purelib', '%s_user' % os.name) return USER_SITE def addusersitepackages(known_paths): |