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

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

Issue 3871: cross and native build of python for mingw32 with distutils
Patch Set: Created 7 years, 2 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/ctypes/util.py ('k') | Lib/distutils/command/build_ext.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 """distutils.ccompiler 1 """distutils.ccompiler
2 2
3 Contains CCompiler, an abstract base class that defines the interface 3 Contains CCompiler, an abstract base class that defines the interface
4 for the Distutils compiler abstraction model.""" 4 for the Distutils compiler abstraction model."""
5 5
6 import sys, os, re 6 import sys, os, re
7 from distutils.errors import * 7 from distutils.errors import *
8 from distutils.spawn import spawn 8 from distutils.spawn import spawn
9 from distutils.file_util import move_file 9 from distutils.file_util import move_file
10 from distutils.dir_util import mkpath 10 from distutils.dir_util import mkpath
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 supports dependency tracking, but only at a coarse 557 supports dependency tracking, but only at a coarse
558 granularity. 558 granularity.
559 559
560 Raises CompileError on failure. 560 Raises CompileError on failure.
561 """ 561 """
562 # A concrete compiler class can either override this method 562 # A concrete compiler class can either override this method
563 # entirely or implement _compile(). 563 # entirely or implement _compile().
564 macros, objects, extra_postargs, pp_opts, build = \ 564 macros, objects, extra_postargs, pp_opts, build = \
565 self._setup_compile(output_dir, macros, include_dirs, sources, 565 self._setup_compile(output_dir, macros, include_dirs, sources,
566 depends, extra_postargs) 566 depends, extra_postargs)
567
567 cc_args = self._get_cc_args(pp_opts, debug, extra_preargs) 568 cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
568 569
569 for obj in objects: 570 for obj in objects:
570 try: 571 try:
571 src, ext = build[obj] 572 src, ext = build[obj]
572 except KeyError: 573 except KeyError:
573 continue 574 continue
574 self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) 575 self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
575 576
576 # Return *all* object filenames, not just the ones we just built. 577 # Return *all* object filenames, not just the ones we just built.
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 ones returned by os.name) and platform the common value 942 ones returned by os.name) and platform the common value
942 returned by sys.platform for the platform in question. 943 returned by sys.platform for the platform in question.
943 944
944 The default values are os.name and sys.platform in case the 945 The default values are os.name and sys.platform in case the
945 parameters are not given. 946 parameters are not given.
946 """ 947 """
947 if osname is None: 948 if osname is None:
948 osname = os.name 949 osname = os.name
949 if platform is None: 950 if platform is None:
950 platform = sys.platform 951 platform = sys.platform
952 if osname == "nt" and sys.version.find('GCC') >= 0:
953 return 'mingw32'
951 for pattern, compiler in _default_compilers: 954 for pattern, compiler in _default_compilers:
952 if re.match(pattern, platform) is not None or \ 955 if re.match(pattern, platform) is not None or \
953 re.match(pattern, osname) is not None: 956 re.match(pattern, osname) is not None:
954 return compiler 957 return compiler
955 # Default to Unix compiler 958 # Default to Unix compiler
956 return 'unix' 959 return 'unix'
957 960
958 # Map compiler types to (module_name, class_name) pairs -- ie. where to 961 # Map compiler types to (module_name, class_name) pairs -- ie. where to
959 # find the code that implements an interface to this compiler. (The module 962 # find the code that implements an interface to this compiler. (The module
960 # is assumed to be in the 'distutils' package.) 963 # is assumed to be in the 'distutils' package.)
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 if lib_dir: 1112 if lib_dir:
1110 lib_file = compiler.find_library_file([lib_dir], lib_name) 1113 lib_file = compiler.find_library_file([lib_dir], lib_name)
1111 if lib_file: 1114 if lib_file:
1112 lib_opts.append(lib_file) 1115 lib_opts.append(lib_file)
1113 else: 1116 else:
1114 compiler.warn("no library file corresponding to " 1117 compiler.warn("no library file corresponding to "
1115 "'%s' found (skipping)" % lib) 1118 "'%s' found (skipping)" % lib)
1116 else: 1119 else:
1117 lib_opts.append(compiler.library_option (lib)) 1120 lib_opts.append(compiler.library_option (lib))
1118 return lib_opts 1121 return lib_opts
OLDNEW
« no previous file with comments | « Lib/ctypes/util.py ('k') | Lib/distutils/command/build_ext.py » ('j') | no next file with comments »

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