summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/unixccompiler.py
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-08-30 03:52:21 (GMT)
committerCollin Winter <collinw@gmail.com>2007-08-30 03:52:21 (GMT)
commit5b7e9d76f39dbf63573519c178835f72e5a5027a (patch)
tree96b04b9d52d875c9f39d148d88efeafb5184fd35 /Lib/distutils/unixccompiler.py
parenta73bfee73da519a508e7d95bc55c1984ae7089bd (diff)
downloadcpython-5b7e9d76f39dbf63573519c178835f72e5a5027a.zip
cpython-5b7e9d76f39dbf63573519c178835f72e5a5027a.tar.gz
cpython-5b7e9d76f39dbf63573519c178835f72e5a5027a.tar.bz2
General cleanup, raise normalization in Lib/distutils.
Diffstat (limited to 'Lib/distutils/unixccompiler.py')
-rw-r--r--Lib/distutils/unixccompiler.py31
1 files changed, 15 insertions, 16 deletions
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index d07ae1e..91d0dff 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -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)