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/msvccompiler.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/msvccompiler.py')
-rw-r--r-- | Lib/distutils/msvccompiler.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py index b6ff432..06b415e 100644 --- a/Lib/distutils/msvccompiler.py +++ b/Lib/distutils/msvccompiler.py @@ -14,7 +14,8 @@ import sys, os, string from types import * from distutils.errors import * from distutils.ccompiler import \ - CCompiler, gen_preprocess_options, gen_lib_options + CCompiler, gen_preprocess_options, gen_lib_options, \ + CompileError, LibError, LinkError _can_read_reg = 0 @@ -261,9 +262,12 @@ class MSVCCompiler (CCompiler) : output_opt = "/Fo" + obj self.mkpath (os.path.dirname (obj)) - self.spawn ([self.cc] + compile_opts + pp_opts + - [input_opt, output_opt] + - extra_postargs) + try: + self.spawn ([self.cc] + compile_opts + pp_opts + + [input_opt, output_opt] + + extra_postargs) + except DistutilsExecError, msg: + raise CompileError, msg return objects @@ -290,7 +294,11 @@ class MSVCCompiler (CCompiler) : lib_args[:0] = extra_preargs if extra_postargs: lib_args.extend (extra_postargs) - self.spawn ([self.link] + ld_args) + try: + self.spawn ([self.link] + ld_args) + except DistutilsExecError, msg: + raise LibError, msg + else: self.announce ("skipping %s (up-to-date)" % output_filename) @@ -370,7 +378,10 @@ class MSVCCompiler (CCompiler) : print " output_filename =", output_filename print " mkpath'ing:", os.path.dirname (output_filename) self.mkpath (os.path.dirname (output_filename)) - self.spawn ([self.link] + ld_args) + try: + self.spawn ([self.link] + ld_args) + except DistutilsExecError, msg: + raise LinkError, msg else: self.announce ("skipping %s (up-to-date)" % output_filename) @@ -420,7 +431,10 @@ class MSVCCompiler (CCompiler) : ld_args.extend (extra_postargs) self.mkpath (os.path.dirname (output_filename)) - self.spawn ([self.link] + ld_args) + try: + self.spawn ([self.link] + ld_args) + except DistutilsExecError, msg: + raise LinkError, msg else: self.announce ("skipping %s (up-to-date)" % output_filename) |