General cleanup, raise normalization in Lib/distutils.

This commit is contained in:
Collin Winter 2007-08-30 03:52:21 +00:00
parent a73bfee73d
commit 5b7e9d76f3
47 changed files with 963 additions and 1640 deletions

View file

@ -50,7 +50,7 @@ def _darwin_compiler_fixup(compiler_so, cc_args):
build, without a way to remove an architecture. Furthermore GCC will
barf if multiple '-isysroot' arguments are present.
"""
stripArch = stripSysroot = 0
stripArch = stripSysroot = False
compiler_so = list(compiler_so)
kernel_version = os.uname()[2] # 8.4.3
@ -65,7 +65,7 @@ def _darwin_compiler_fixup(compiler_so, cc_args):
stripSysroot = '-isysroot' in cc_args
if stripArch:
while 1:
while True:
try:
index = compiler_so.index('-arch')
# Strip this argument and the next one:
@ -137,11 +137,10 @@ class UnixCCompiler(CCompiler):
if sys.platform == "cygwin":
exe_extension = ".exe"
def preprocess(self, source,
output_file=None, macros=None, include_dirs=None,
extra_preargs=None, extra_postargs=None):
ignore, macros, include_dirs = \
self._fix_compile_args(None, macros, include_dirs)
def preprocess(self, source, output_file=None, macros=None,
include_dirs=None, extra_preargs=None, extra_postargs=None):
fixed_args = self._fix_compile_args(None, macros, include_dirs)
ignore, macros, include_dirs = fixed_args
pp_opts = gen_preprocess_options(macros, include_dirs)
pp_args = self.preprocessor + pp_opts
if output_file:
@ -162,7 +161,7 @@ class UnixCCompiler(CCompiler):
try:
self.spawn(pp_args)
except DistutilsExecError as msg:
raise CompileError, msg
raise CompileError(msg)
def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
compiler_so = self.compiler_so
@ -172,7 +171,7 @@ class UnixCCompiler(CCompiler):
self.spawn(compiler_so + cc_args + [src, '-o', obj] +
extra_postargs)
except DistutilsExecError as msg:
raise CompileError, msg
raise CompileError(msg)
def create_static_lib(self, objects, output_libname,
output_dir=None, debug=0, target_lang=None):
@ -196,7 +195,7 @@ class UnixCCompiler(CCompiler):
try:
self.spawn(self.ranlib + [output_filename])
except DistutilsExecError as msg:
raise LibError, msg
raise LibError(msg)
else:
log.debug("skipping %s (up-to-date)", output_filename)
@ -206,13 +205,14 @@ class UnixCCompiler(CCompiler):
export_symbols=None, debug=0, extra_preargs=None,
extra_postargs=None, build_temp=None, target_lang=None):
objects, output_dir = self._fix_object_args(objects, output_dir)
libraries, library_dirs, runtime_library_dirs = \
self._fix_lib_args(libraries, library_dirs, runtime_library_dirs)
fixed_args = self._fix_lib_args(libraries, library_dirs,
runtime_library_dirs)
libraries, library_dirs, runtime_library_dirs = fixed_args
lib_opts = gen_lib_options(self, library_dirs, runtime_library_dirs,
libraries)
if not isinstance(output_dir, (basestring, type(None))):
raise TypeError, "'output_dir' must be a string or None"
raise TypeError("'output_dir' must be a string or None")
if output_dir is not None:
output_filename = os.path.join(output_dir, output_filename)
@ -241,8 +241,7 @@ class UnixCCompiler(CCompiler):
if os.path.basename(linker[0]) == "env":
i = 1
while '=' in linker[i]:
i = i + 1
i += 1
linker[i] = self.compiler_cxx[i]
if sys.platform == 'darwin':
@ -250,7 +249,7 @@ class UnixCCompiler(CCompiler):
self.spawn(linker + ld_args)
except DistutilsExecError as msg:
raise LinkError, msg
raise LinkError(msg)
else:
log.debug("skipping %s (up-to-date)", output_filename)