[BUG][0.90.0] './setup.py install' on systems without gcc didn't work for me

Martin Pool mbp at sourcefrog.net
Tue Sep 11 08:25:28 BST 2007


On 9/11/07, Lukáš Lalinský <lalinsky at gmail.com> wrote:

> What about something like this? Instead of looking for a C compiler in
> setup.py (which distutils.compiler has to do, anyway), simply check if
> the compilation failed and print a warning without breaking the build
> process.

@@ -165,8 +167,18 @@

     from distutils.command.build_ext import build_ext

 else:

     have_pyrex = True

+

+class my_build_ext(build_ext):

+

+    def build_extension(self, ext):

+        try:

+            build_ext.build_extension(self, ext)

+        except CCompilerError:

+            log.warn("building of '%s' extension failed, will "

+                     "use the Python version instead" % (ext.name,))

+

 # Override the build_ext if we have Pyrex available

-command_classes['build_ext'] = build_ext

+command_classes['build_ext'] = my_build_ext

 unavailable_files = []



 That looks reasonable to me, except that I'd change the null name
"my_build_ext" to something like "build_ext_if_possible".  By the way,
when posting patches, please remember to put '[merge]' in the
subject, even if you're replying to someone else, so that bundle buggy
will catch it.


-- 
Martin



More information about the bazaar mailing list