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

Side by Side Diff: Lib/distutils/sysconfig.py

Issue 17086: backport cross-build patches to the 2.7 branch
Patch Set: Created 6 years, 6 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 | « configure.ac ('k') | Lib/distutils/util.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 """Provide access to Python's configuration information. The specific 1 """Provide access to Python's configuration information. The specific
2 configuration variables available depend heavily on the platform and 2 configuration variables available depend heavily on the platform and
3 configuration. The values may be retrieved using 3 configuration. The values may be retrieved using
4 get_config_var(name), and the list of variables is available via 4 get_config_var(name), and the list of variables is available via
5 get_config_vars().keys(). Additional convenience functions are also 5 get_config_vars().keys(). Additional convenience functions are also
6 available. 6 available.
7 7
8 Written by: Fred L. Drake, Jr. 8 Written by: Fred L. Drake, Jr.
9 Email: <fdrake@acm.org> 9 Email: <fdrake@acm.org>
10 """ 10 """
(...skipping 18 matching lines...) Expand all
29 if os.name == "nt" and "pcbuild" in project_base[-8:].lower(): 29 if os.name == "nt" and "pcbuild" in project_base[-8:].lower():
30 project_base = os.path.abspath(os.path.join(project_base, os.path.pardir)) 30 project_base = os.path.abspath(os.path.join(project_base, os.path.pardir))
31 # PC/VS7.1 31 # PC/VS7.1
32 if os.name == "nt" and "\\pc\\v" in project_base[-10:].lower(): 32 if os.name == "nt" and "\\pc\\v" in project_base[-10:].lower():
33 project_base = os.path.abspath(os.path.join(project_base, os.path.pardir, 33 project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
34 os.path.pardir)) 34 os.path.pardir))
35 # PC/AMD64 35 # PC/AMD64
36 if os.name == "nt" and "\\pcbuild\\amd64" in project_base[-14:].lower(): 36 if os.name == "nt" and "\\pcbuild\\amd64" in project_base[-14:].lower():
37 project_base = os.path.abspath(os.path.join(project_base, os.path.pardir, 37 project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
38 os.path.pardir)) 38 os.path.pardir))
39
40 # set for cross builds
41 if "_PYTHON_PROJECT_BASE" in os.environ:
42 # this is the build directory, at least for posix
43 project_base = os.path.normpath(os.environ["_PYTHON_PROJECT_BASE"])
39 44
40 # python_build: (Boolean) if true, we're either building Python or 45 # python_build: (Boolean) if true, we're either building Python or
41 # building an extension with an un-installed Python, so we use 46 # building an extension with an un-installed Python, so we use
42 # different (hard-wired) directories. 47 # different (hard-wired) directories.
43 # Setup.local is available for Makefile builds including VPATH builds, 48 # Setup.local is available for Makefile builds including VPATH builds,
44 # Setup.dist is available on Windows 49 # Setup.dist is available on Windows
45 def _python_build(): 50 def _python_build():
46 for fn in ("Setup.dist", "Setup.local"): 51 for fn in ("Setup.dist", "Setup.local"):
47 if os.path.isfile(os.path.join(project_base, "Modules", fn)): 52 if os.path.isfile(os.path.join(project_base, "Modules", fn)):
48 return True 53 return True
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 config_h = 'config.h' 242 config_h = 'config.h'
238 else: 243 else:
239 # The name of the config.h file changed in 2.2 244 # The name of the config.h file changed in 2.2
240 config_h = 'pyconfig.h' 245 config_h = 'pyconfig.h'
241 return os.path.join(inc_dir, config_h) 246 return os.path.join(inc_dir, config_h)
242 247
243 248
244 def get_makefile_filename(): 249 def get_makefile_filename():
245 """Return full pathname of installed Makefile from the Python build.""" 250 """Return full pathname of installed Makefile from the Python build."""
246 if python_build: 251 if python_build:
247 return os.path.join(os.path.dirname(sys.executable), "Makefile") 252 return os.path.join(project_base, "Makefile")
248 lib_dir = get_python_lib(plat_specific=1, standard_lib=1) 253 lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
249 return os.path.join(lib_dir, "config", "Makefile") 254 return os.path.join(lib_dir, "config", "Makefile")
250 255
251 256
252 def parse_config_h(fp, g=None): 257 def parse_config_h(fp, g=None):
253 """Parse a config.h-style file. 258 """Parse a config.h-style file.
254 259
255 A dictionary containing name/value pairs is returned. If an 260 A dictionary containing name/value pairs is returned. If an
256 optional dictionary is passed in as the second argument, it is 261 optional dictionary is passed in as the second argument, it is
257 used instead of a new dictionary. 262 used instead of a new dictionary.
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 return vals 591 return vals
587 else: 592 else:
588 return _config_vars 593 return _config_vars
589 594
590 def get_config_var(name): 595 def get_config_var(name):
591 """Return the value of a single variable using the dictionary 596 """Return the value of a single variable using the dictionary
592 returned by 'get_config_vars()'. Equivalent to 597 returned by 'get_config_vars()'. Equivalent to
593 get_config_vars().get(name) 598 get_config_vars().get(name)
594 """ 599 """
595 return get_config_vars().get(name) 600 return get_config_vars().get(name)
OLDNEW
« no previous file with comments | « configure.ac ('k') | Lib/distutils/util.py » ('j') | no next file with comments »

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