Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(169239)

Side by Side Diff: Lib/sysconfig.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/subprocess.py ('k') | Lib/test/libregrtest/main.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Access to Python's configuration information.""" 1 """Access to Python's configuration information."""
2 2
3 import os 3 import os
4 import sys 4 import sys
5 from os.path import pardir, realpath 5 from os.path import pardir, realpath
6 6
7 __all__ = [ 7 __all__ = [
8 'get_config_h_filename', 8 'get_config_h_filename',
9 'get_config_var', 9 'get_config_var',
10 'get_config_vars', 10 'get_config_vars',
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 'data': '{userbase}', 70 'data': '{userbase}',
71 }, 71 },
72 'osx_framework_user': { 72 'osx_framework_user': {
73 'stdlib': '{userbase}/lib/python', 73 'stdlib': '{userbase}/lib/python',
74 'platstdlib': '{userbase}/lib/python', 74 'platstdlib': '{userbase}/lib/python',
75 'purelib': '{userbase}/lib/python/site-packages', 75 'purelib': '{userbase}/lib/python/site-packages',
76 'platlib': '{userbase}/lib/python/site-packages', 76 'platlib': '{userbase}/lib/python/site-packages',
77 'include': '{userbase}/include', 77 'include': '{userbase}/include',
78 'scripts': '{userbase}/bin', 78 'scripts': '{userbase}/bin',
79 'data': '{userbase}', 79 'data': '{userbase}',
80 },
81 'ios': {
82 'stdlib': '{installed_base}/lib/python%s' % sys.version[:3],
83 'platstdlib': '{installed_base}/lib/python%s' % sys.version[:3],
84 'purelib': '{installed_base}/lib/python%s/site-packages' % sys.version[: 3],
85 'platlib': '{installed_base}/lib/python%s/site-packages' % sys.version[: 3],
86 'include': '{installed_base}/include',
87 'scripts': '{installed_base}/bin',
88 'data': '{installed_base}/Resources',
80 }, 89 },
81 } 90 }
82 91
83 _SCHEME_KEYS = ('stdlib', 'platstdlib', 'purelib', 'platlib', 'include', 92 _SCHEME_KEYS = ('stdlib', 'platstdlib', 'purelib', 'platlib', 'include',
84 'scripts', 'data') 93 'scripts', 'data')
85 94
86 # FIXME don't rely on sys.version here, its format is an implementation detail 95 # FIXME don't rely on sys.version here, its format is an implementation detail
87 # of CPython, use sys.version_info or sys.hexversion 96 # of CPython, use sys.version_info or sys.hexversion
88 _PY_VERSION = sys.version.split()[0] 97 _PY_VERSION = sys.version.split()[0]
89 _PY_VERSION_SHORT = '%d.%d' % sys.version_info[:2] 98 _PY_VERSION_SHORT = '%d.%d' % sys.version_info[:2]
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 if os.name in ('posix', 'nt'): 176 if os.name in ('posix', 'nt'):
168 value = os.path.expanduser(value) 177 value = os.path.expanduser(value)
169 res[key] = os.path.normpath(_subst_vars(value, vars)) 178 res[key] = os.path.normpath(_subst_vars(value, vars))
170 return res 179 return res
171 180
172 181
173 def _get_default_scheme(): 182 def _get_default_scheme():
174 if os.name == 'posix': 183 if os.name == 'posix':
175 # the default scheme for posix is posix_prefix 184 # the default scheme for posix is posix_prefix
176 return 'posix_prefix' 185 return 'posix_prefix'
186 elif sys.platform == 'ios':
187 return 'ios'
177 return os.name 188 return os.name
178 189
179 190
180 def _getuserbase(): 191 def _getuserbase():
181 env_base = os.environ.get("PYTHONUSERBASE", None) 192 env_base = os.environ.get("PYTHONUSERBASE", None)
182 193
183 def joinuser(*args): 194 def joinuser(*args):
184 return os.path.expanduser(os.path.join(*args)) 195 return os.path.expanduser(os.path.join(*args))
185 196
186 if os.name == "nt": 197 if os.name == "nt":
187 base = os.environ.get("APPDATA") or "~" 198 base = os.environ.get("APPDATA") or "~"
188 if env_base: 199 if env_base:
189 return env_base 200 return env_base
190 else: 201 else:
191 return joinuser(base, "Python") 202 return joinuser(base, "Python")
192 203
193 if sys.platform == "darwin": 204 if sys.platform == "darwin":
194 framework = get_config_var("PYTHONFRAMEWORK") 205 framework = get_config_var("PYTHONFRAMEWORK")
195 if framework: 206 if framework:
196 if env_base: 207 if env_base:
197 return env_base 208 return env_base
198 else: 209 else:
199 return joinuser("~", "Library", framework, "%d.%d" % 210 return joinuser("~", "Library", framework, "%d.%d" %
200 sys.version_info[:2]) 211 sys.version_info[:2])
212 elif sys.platform == 'ios':
213 if env_base:
214 return env_base
215 else:
216 return _BASE_PREFIX
201 217
202 if env_base: 218 if env_base:
203 return env_base 219 return env_base
204 else: 220 else:
205 return joinuser("~", ".local") 221 return joinuser("~", ".local")
206 222
207 223
208 def _parse_makefile(filename, vars=None): 224 def _parse_makefile(filename, vars=None):
209 """Parse a Makefile-style file. 225 """Parse a Makefile-style file.
210 226
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 print('Python version: "%s"' % get_python_version()) 714 print('Python version: "%s"' % get_python_version())
699 print('Current installation scheme: "%s"' % _get_default_scheme()) 715 print('Current installation scheme: "%s"' % _get_default_scheme())
700 print() 716 print()
701 _print_dict('Paths', get_paths()) 717 _print_dict('Paths', get_paths())
702 print() 718 print()
703 _print_dict('Variables', get_config_vars()) 719 _print_dict('Variables', get_config_vars())
704 720
705 721
706 if __name__ == '__main__': 722 if __name__ == '__main__':
707 _main() 723 _main()
OLDNEW
« no previous file with comments | « Lib/subprocess.py ('k') | Lib/test/libregrtest/main.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+