diff options
author | Greg Ward <gward@python.net> | 2000-05-30 01:56:44 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-05-30 01:56:44 (GMT) |
commit | d151711e66d1077669025b3fda5616bf31935538 (patch) | |
tree | 27c09ccd8e3ae32cea2adf383b08011a18fd7e98 /Lib/distutils/unixccompiler.py | |
parent | adda156a13c8555ea6f809bca8488d10d21dec62 (diff) | |
download | cpython-d151711e66d1077669025b3fda5616bf31935538.zip cpython-d151711e66d1077669025b3fda5616bf31935538.tar.gz cpython-d151711e66d1077669025b3fda5616bf31935538.tar.bz2 |
Changed to catch compile/link failures and raise CompileError, LibError,
or LinkError (exception classes defined in ccompiler.py).
Diffstat (limited to 'Lib/distutils/unixccompiler.py')
-rw-r--r-- | Lib/distutils/unixccompiler.py | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py index 40f564a..c2f841f 100644 --- a/Lib/distutils/unixccompiler.py +++ b/Lib/distutils/unixccompiler.py @@ -21,7 +21,10 @@ import string, re, os from types import * from copy import copy from distutils import sysconfig -from distutils.ccompiler import CCompiler, gen_preprocess_options, gen_lib_options +from distutils.ccompiler import \ + CCompiler, gen_preprocess_options, gen_lib_options, \ + CompileError, LibError, LinkError +from distutils.errors import DistutilsExecError # XXX Things not currently handled: # * optimization/debug/warning flags; we just use whatever's in Python's @@ -132,7 +135,12 @@ class UnixCCompiler (CCompiler): self.announce ("skipping %s (%s up-to-date)" % (src, obj)) else: self.mkpath (os.path.dirname (obj)) - self.spawn ([self.cc] + cc_args + [src, '-o', obj] + extra_postargs) + try: + self.spawn ([self.cc] + cc_args + + [src, '-o', obj] + + extra_postargs) + except DistutilsExecError, msg: + raise CompileError, msg # Return *all* object filenames, not just the ones we just built. return objects @@ -164,7 +172,10 @@ class UnixCCompiler (CCompiler): # needed -- or maybe Python's configure script took care of # it for us, hence the check for leading colon. if self.ranlib[0] != ':': - self.spawn ([self.ranlib, output_filename]) + try: + self.spawn ([self.ranlib, output_filename]) + except DistutilsExecError, msg: + raise LibError, msg else: self.announce ("skipping %s (up-to-date)" % output_filename) @@ -229,7 +240,10 @@ class UnixCCompiler (CCompiler): if extra_postargs: ld_args.extend (extra_postargs) self.mkpath (os.path.dirname (output_filename)) - self.spawn ([self.ld_shared] + ld_args) + try: + self.spawn ([self.ld_shared] + ld_args) + except DistutilsExecError, msg: + raise LinkError, msg else: self.announce ("skipping %s (up-to-date)" % output_filename) @@ -267,7 +281,10 @@ class UnixCCompiler (CCompiler): if extra_postargs: ld_args.extend (extra_postargs) self.mkpath (os.path.dirname (output_filename)) - self.spawn ([self.ld_exec] + ld_args) + try: + self.spawn ([self.ld_exec] + ld_args) + except DistutilsExecError, msg: + raise LinkError, msg else: self.announce ("skipping %s (up-to-date)" % output_filename) |