# HG changeset patch
# User Bob Ippolito <bob@redivi.com>
# Date 1174772129 0
#      Sat Mar 24 21:35:29 2007 +0000
# Node ID 2fad7dda50f63cb8eb5a9f38beb3cdbd5acafa55
# Parent  6ed6e9526ec95cc0ea601e218ace721141450bbe
tweak build_ext to not fail

git-svn-id: http://simplejson.googlecode.com/svn/trunk@50 a4795897-2c25-0410-b006-0d3caba88fa1

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -4,8 +4,10 @@
 ez_setup.use_setuptools()
 
 from setuptools import setup, find_packages, Extension, Feature
+from distutils.command.build_ext import build_ext
+from distutils.errors import CCompilerError
 
-VERSION = '1.7'
+VERSION = '1.7.1'
 DESCRIPTION = "Simple, fast, extensible JSON encoder/decoder for Python"
 LONG_DESCRIPTION = """
 simplejson is a simple, fast, complete, correct and extensible
@@ -32,6 +34,23 @@
 Topic :: Software Development :: Libraries :: Python Modules
 """.splitlines()))
 
+
+BUILD_EXT_WARNING="""
+WARNING: The C extension could not be compiled, speedups are not enabled.
+
+Above is the output showing how the compilation failed.
+"""
+
+class ve_build_ext(build_ext):
+    # This class allows C extension building to fail.
+    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')
+
 speedups = Feature(
     "options C speed-enhancement modules",
     standard=True,
@@ -58,4 +77,5 @@
         'paste.filter_app_factory': ['json = simplejson.jsonfilter:factory'],
     },
     features={'speedups': speedups},
+    cmdclass={'build_ext': ve_build_ext},
 )
diff --git a/simplejson/__init__.py b/simplejson/__init__.py
--- a/simplejson/__init__.py
+++ b/simplejson/__init__.py
@@ -86,7 +86,7 @@
 Note that the JSON produced by this module's default settings
 is a subset of YAML, so it may be used as a serializer for that as well.
 """
-__version__ = '1.7'
+__version__ = '1.7.1'
 __all__ = [
     'dump', 'dumps', 'load', 'loads',
     'JSONDecoder', 'JSONEncoder',