# Pull in the tools we need.
# Distribute is a new fork of setuptools. It's supported on Py3.x, so we use
# it there, but stick with classic setuptools on Py2.x until Distribute becomes
Is there a duck-typing way to know we can't compile extensions ?
+# can't compile extensions
if not sys.platform.startswith('java'):
+# For a variety of reasons, it might not be possible to install the C
+# extension. Try it with, and if it fails, try it without.
+ if 'ext_modules' not in setup_args:
+ msg = "Couldn't install with extension module, trying without it..."
+ exc_msg = traceback.format_exc(0).split('\n')[-2]
+ print("**\n** %s\n** %s\n**" % (msg, exc_msg))
+ del setup_args['ext_modules']