summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2008-02-23 07:03:35 +0000
committerBob Ippolito <bob@redivi.com>2008-02-23 07:03:35 +0000
commit19e33c1c118f23c16265af410ea2b50877ac4524 (patch)
tree02014ee5a6e1b10a1a8e33cba074e61eb838769a
parent1a7035f18fdb435a0d645f8a202d8b1ecf9c1bef (diff)
downloadsimplejson-19e33c1c118f23c16265af410ea2b50877ac4524.tar.gz
better handling for the lack of a compiler
git-svn-id: http://simplejson.googlecode.com/svn/trunk@58 a4795897-2c25-0410-b006-0d3caba88fa1
-rw-r--r--setup.py26
1 files changed, 19 insertions, 7 deletions
diff --git a/setup.py b/setup.py
index 787df74..a4303d9 100644
--- a/setup.py
+++ b/setup.py
@@ -15,7 +15,8 @@ except TypeError:
from setuptools import setup, find_packages, Extension, Feature
from distutils.command.build_ext import build_ext
-from distutils.errors import CCompilerError
+from distutils.errors import CCompilerError, DistutilsExecError, \
+ DistutilsPlatformError
VERSION = '1.7.4'
DESCRIPTION = "Simple, fast, extensible JSON encoder/decoder for Python"
@@ -45,21 +46,32 @@ Topic :: Software Development :: Libraries :: Python Modules
""".splitlines()))
-BUILD_EXT_WARNING="""
+BUILD_EXT_WARNING="""\
WARNING: The C extension could not be compiled, speedups are not enabled.
-Above is the output showing how the compilation failed.
+Below is the output showing how the compilation failed:
"""
class ve_build_ext(build_ext):
# This class allows C extension building to fail.
+
+ def run(self):
+ try:
+ build_ext.run(self)
+ except DistutilsPlatformError, x:
+ self._unavailable(x)
+
def build_extension(self, ext):
try:
build_ext.build_extension(self, ext)
- except CCompilerError, x:
- print ('*'*70+'\n')
- print BUILD_EXT_WARNING
- print ('*'*70+'\n')
+ except (CCompilerError, DistutilsExecError), x:
+ self._unavailable(x)
+
+ def _unavailable(self, exc):
+ print '*'*70
+ print BUILD_EXT_WARNING
+ print exc
+ print '*'*70
speedups = Feature(
"options C speed-enhancement modules",