summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2010-05-08 10:49:43 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2010-05-08 10:49:43 (GMT)
commit4cda46ab9167ab6c46e1cbb6caea6fbb021605ac (patch)
tree9e0c6e4f31d11750664e51b9579ee3c64c1ddbc7
parente97ecba241118e28100c70c5f48fcaabf32b79b7 (diff)
downloadcpython-4cda46ab9167ab6c46e1cbb6caea6fbb021605ac.zip
cpython-4cda46ab9167ab6c46e1cbb6caea6fbb021605ac.tar.gz
cpython-4cda46ab9167ab6c46e1cbb6caea6fbb021605ac.tar.bz2
Merged revisions 80967 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r80967 | ronald.oussoren | 2010-05-08 12:29:06 +0200 (Sat, 08 May 2010) | 4 lines Issue #8084: ensure that the --user directory conforms to platforms standars on OSX when using a python framework. ........
-rw-r--r--Lib/site.py17
-rw-r--r--Lib/sysconfig.py21
-rw-r--r--Misc/NEWS3
3 files changed, 34 insertions, 7 deletions
diff --git a/Lib/site.py b/Lib/site.py
index d99b538..8563df2 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -240,6 +240,13 @@ def getusersitepackages():
from sysconfig import get_path
import os
+
+ if sys.platform == 'darwin':
+ from sysconfig import get_config_var
+ if get_config_var('PYTHONFRAMEWORK'):
+ USER_SITE = get_path('purelib', 'osx_framework_user')
+ return USER_SITE
+
USER_SITE = get_path('purelib', '%s_user' % os.name)
return USER_SITE
@@ -286,13 +293,11 @@ def getsitepackages():
if sys.platform == "darwin":
# for framework builds *only* we add the standard Apple
# locations.
- if 'Python.framework' in prefix:
- sitepackages.append(
- os.path.expanduser(
- os.path.join("~", "Library", "Python",
- sys.version[:3], "site-packages")))
+ from sysconfig import get_config_var
+ framework = get_config_var("PYTHONFRAMEWORK")
+ if framework and "/%s.framework/"%(framework,) in prefix:
sitepackages.append(
- os.path.join("/Library", "Python",
+ os.path.join("/Library", framework,
sys.version[:3], "site-packages"))
return sitepackages
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index 0122f08..f38c8d2 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -73,6 +73,15 @@ _INSTALL_SCHEMES = {
'scripts': '{userbase}/bin',
'data' : '{userbase}',
},
+ 'osx_framework_user': {
+ 'stdlib': '{userbase}/lib/python',
+ 'platstdlib': '{userbase}/lib/python',
+ 'purelib': '{userbase}/lib/python/site-packages',
+ 'platlib': '{userbase}/lib/python/site-packages',
+ 'include': '{userbase}/include',
+ 'scripts': '{userbase}/bin',
+ 'data' : '{userbase}',
+ },
}
_SCHEME_KEYS = ('stdlib', 'platstdlib', 'purelib', 'platlib', 'include',
@@ -157,6 +166,12 @@ def _getuserbase():
base = os.environ.get("APPDATA") or "~"
return env_base if env_base else joinuser(base, "Python")
+ if sys.platform == "darwin":
+ framework = get_config_var("PYTHONFRAMEWORK")
+ if framework:
+ return joinuser("~", "Library", framework, "%d.%d"%(
+ sys.version_info[:2]))
+
return env_base if env_base else joinuser("~", ".local")
@@ -400,13 +415,17 @@ def get_config_vars(*args):
_CONFIG_VARS['py_version_nodot'] = _PY_VERSION[0] + _PY_VERSION[2]
_CONFIG_VARS['base'] = _PREFIX
_CONFIG_VARS['platbase'] = _EXEC_PREFIX
- _CONFIG_VARS['userbase'] = _getuserbase()
_CONFIG_VARS['projectbase'] = _PROJECT_BASE
if os.name in ('nt', 'os2'):
_init_non_posix(_CONFIG_VARS)
if os.name == 'posix':
_init_posix(_CONFIG_VARS)
+ # Setting 'userbase' is done below the call to the
+ # init function to enable using 'get_config_var' in
+ # the init-function.
+ _CONFIG_VARS['userbase'] = _getuserbase()
+
if 'srcdir' not in _CONFIG_VARS:
_CONFIG_VARS['srcdir'] = _PROJECT_BASE
diff --git a/Misc/NEWS b/Misc/NEWS
index d84f1dc..98ec0d2 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -290,6 +290,9 @@ Core and Builtins
- Issue #7072: isspace(0xa0) is true on Mac OS X
+- Issue #8084: PEP 370 now conforms to system conventions for framework
+ builds on MacOS X. That is, "python setup.py install --user" will install
+ into "~/Library/Python/2.7" instead of "~/.local".
C-API
-----