Ticket #3586: patch.txt

File patch.txt, 1.3 KB (added by zooko, 4 years ago)
Line 
1=== modified file 'twisted/python/dist.py'
2--- twisted/python/dist.py      2009-04-14 11:03:09 +0000
3+++ twisted/python/dist.py      2010-04-24 15:48:09 +0000
4@@ -8,7 +8,7 @@
5 
6 import sys, os
7 from distutils.command import build_scripts, install_data, build_ext, build_py
8-from distutils.errors import CompileError
9+from distutils.errors import CompileError, CCompilerError
10 from distutils import core
11 from distutils.core import Extension
12 
13@@ -296,6 +296,13 @@
14 
15 
16 
17+# The technique of ignoring CCompilerError is copied from simplejson 2.1.1.
18+BUILD_EXT_WARNING="""
19+WARNING: The C extension could not be compiled, speedups are not enabled.
20+
21+Above is the output showing how the compilation failed.
22+"""
23+
24 class build_ext_twisted(build_ext.build_ext):
25     """
26     Allow subclasses to easily detect and customize Extensions to
27@@ -325,8 +332,12 @@
28         Check to see which extension modules to build and then build them.
29         """
30         self.prepare_extensions()
31-        build_ext.build_ext.build_extensions(self)
32-
33+        try:
34+            build_ext.build_ext.build_extensions(self)
35+        except CCompilerError, x:
36+            print ('*'*70+'\n')
37+            print BUILD_EXT_WARNING
38+            print ('*'*70+'\n')
39 
40     def _remove_conftest(self):
41         for filename in ("conftest.c", "conftest.o", "conftest.obj"):
42