Fixed setup.py to allow:

1. skipping of extensions which cause an error (a warning message
   is written to stdout, but the build process no longer fails
   completely)

2. the readline extension to compile on SuSE Linux (and probably
   other platforms too) by adding /usr/lib/termcap to the library search
   path
This commit is contained in:
Marc-André Lemburg 2001-01-26 18:03:24 +00:00
parent 49c994239f
commit 7c6fcda7bf
1 changed files with 10 additions and 0 deletions

View File

@ -3,6 +3,7 @@
import sys, os, string, getopt import sys, os, string, getopt
from distutils import sysconfig from distutils import sysconfig
from distutils.errors import *
from distutils.core import Extension, setup from distutils.core import Extension, setup
from distutils.command.build_ext import build_ext from distutils.command.build_ext import build_ext
@ -99,6 +100,14 @@ class PyBuildExt(build_ext):
build_ext.build_extensions(self) build_ext.build_extensions(self)
def build_extension(self, ext):
try:
build_ext.build_extension(self, ext)
except (CCompilerError, DistutilsError), why:
self.announce('WARNING: building of extension "%s" failed: %s' %
(ext.name, sys.exc_info()[1]))
def get_platform (self): def get_platform (self):
# Get value of sys.platform # Get value of sys.platform
platform = sys.platform platform = sys.platform
@ -235,6 +244,7 @@ class PyBuildExt(build_ext):
# readline # readline
if (self.compiler.find_library_file(lib_dirs, 'readline')): if (self.compiler.find_library_file(lib_dirs, 'readline')):
exts.append( Extension('readline', ['readline.c'], exts.append( Extension('readline', ['readline.c'],
library_dirs=['/usr/lib/termcap'],
libraries=['readline', 'termcap']) ) libraries=['readline', 'termcap']) )
# The crypt module is now disabled by default because it breaks builds # The crypt module is now disabled by default because it breaks builds