Ned Batchelder  committed 740b68e now succeeds even if there is no C compiler. Fixes issue #80.

  • Participants
  • Parent commits c7506f5

Comments (0)

Files changed (2)

   possible, to get the best handling of Python source files with encodings.
   Closes `issue 107`, thanks, Brett Cannon.
+- Installation from source now succeeds on machines without a C compiler,
+  closing `issue 80`. 
 - Internally, files are now closed explicitly, fixing `issue 104`.  Thanks,
   Brett Cannon.
+.. _issue 80:
 .. _issue 93:
 .. _issue 95:
 .. _issue 104:
 # Pull in the tools we need.
-import sys
+import sys, traceback
 # 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
     url = __url__,
-# Is there a duck-typing way to know we can't compile extensions?
+# Jython can't compile C extensions
 if not sys.platform.startswith('java'):
         ext_modules = [
+# 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.
+    setup(**setup_args)
+    if 'ext_modules' not in setup_args:
+        raise
+    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']
+    setup(**setup_args)