Skip to content
Snippets Groups Projects
Commit 0a40d9dfbd28 authored by Bob Ippolito's avatar Bob Ippolito
Browse files

better handling for the lack of a compiler

git-svn-id: http://simplejson.googlecode.com/svn/trunk@58 a4795897-2c25-0410-b006-0d3caba88fa1
parent 3f97e43976f6
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,8 @@
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,6 +46,6 @@
""".splitlines()))
BUILD_EXT_WARNING="""
BUILD_EXT_WARNING="""\
WARNING: The C extension could not be compiled, speedups are not enabled.
......@@ -49,7 +50,7 @@
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.
......@@ -52,7 +53,14 @@
"""
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)
......@@ -56,6 +64,9 @@
def build_extension(self, ext):
try:
build_ext.build_extension(self, ext)
except CCompilerError, x:
print ('*'*70+'\n')
except (CCompilerError, DistutilsExecError), x:
self._unavailable(x)
def _unavailable(self, exc):
print '*'*70
print BUILD_EXT_WARNING
......@@ -61,5 +72,6 @@
print BUILD_EXT_WARNING
print ('*'*70+'\n')
print exc
print '*'*70
speedups = Feature(
"options C speed-enhancement modules",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment