2 from distutils.errors import (CCompilerError, DistutilsExecError,
3 DistutilsPlatformError)
5 from setuptools.command.build_ext import build_ext
7 from distutils.command.build_ext import build_ext
10 class optional_build_ext(build_ext):
11 """This class subclasses build_ext and allows
12 the building of C extensions to fail.
18 except DistutilsPlatformError, e:
21 def build_extension(self, ext):
23 build_ext.build_extension(self, ext)
25 except (CCompilerError, DistutilsExecError), e:
28 def _unavailable(self, e):
29 print >> sys.stderr, '*' * 80
30 print >> sys.stderr, """WARNING:
32 An optional code optimization (C extension) could not be compiled.
34 Optimizations for this package will not be available!"""
36 print >> sys.stderr, e
37 print >> sys.stderr, '*' * 80