From: Lisandro Dalcin Date: Sun, 23 Nov 2008 00:00:37 +0000 (-0300) Subject: add custom distutils build_ext command ignoring C compiler failues when building... X-Git-Tag: 0.11-beta~226^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5c6d28fd88295e4efb4d551441c7edce742e962f;p=cython.git add custom distutils build_ext command ignoring C compiler failues when building Cython --- diff --git a/setup.py b/setup.py index e6cb7b4f..11d2a5d5 100644 --- a/setup.py +++ b/setup.py @@ -29,6 +29,13 @@ try: sys.argv.remove("--no-cython-compile") except ValueError: try: + from distutils.command.build_ext import build_ext as build_ext_orig + class build_ext(build_ext_orig): + def build_extension(self, ext, *args, **kargs): + try: + build_ext_orig.build_extension(self, ext, *args, **kargs) + except StandardError: + print("Compilation of '%s' failed" % ext.sources[0]) from Cython.Compiler.Main import compile source_root = os.path.dirname(__file__) compiled_modules = ["Cython.Plex.Scanners", @@ -48,6 +55,7 @@ except ValueError: print("Compilation failed") if extensions: setup_args['ext_modules'] = extensions + setup_args['cmdclass'] = {"build_ext" : build_ext} except Exception: print("ERROR: %s" % sys.exc_info()[1]) print("Extension module compilation failed, using plain Python implementation")