Edgewall Software

Ticket #165: windows-vs-skip.diff

File windows-vs-skip.diff, 1.1 KB (added by didley@…, 16 years ago)

Don't abort completely if a compiler is not available

  • setup.py

     
    1414
    1515from distutils.cmd import Command
    1616from distutils.command.build_ext import build_ext
    17 from distutils.errors import CCompilerError
     17from distutils.errors import CCompilerError, DistutilsPlatformError
    1818import doctest
    1919from glob import glob
    2020import os
     
    3434
    3535class optional_build_ext(build_ext):
    3636    # This class allows C extension building to fail.
     37    def run(self):
     38        try:
     39            build_ext.run(self)
     40        except DistutilsPlatformError:
     41            self._unavailable()
     42
    3743    def build_extension(self, ext):
    3844        try:
    3945            build_ext.build_extension(self, ext)
    4046        except CCompilerError, x:
    41             print '*' * 70
    42             print """WARNING:
     47            self._unavailable()
     48
     49    def _unavailable(self):
     50        print '*' * 70
     51        print """WARNING:
    4352An optional C extension could not be compiled, speedups will not be
    4453available."""
    45             print '*' * 70
     54        print '*' * 70
    4655
    4756
    4857if Feature: