Index: setup.py
===================================================================
--- setup.py	(revision 809)
+++ setup.py	(working copy)
@@ -14,7 +14,7 @@
 
 from distutils.cmd import Command
 from distutils.command.build_ext import build_ext
-from distutils.errors import CCompilerError, DistutilsPlatformError
+from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError
 import doctest
 from glob import glob
 import os
@@ -22,7 +22,34 @@
     from setuptools import setup, Extension, Feature
 except ImportError:
     from distutils.core import setup, Extension
-    Feature = None
+    extra = {}
+else:
+    speedups = Feature(
+        "optionial C speed-enhancements",
+        standard = True,
+        ext_modules = [
+            Extension('genshi._speedups', ['genshi/_speedups.c']),
+        ],
+    )
+
+    extra = dict(
+        zip_safe = True,
+        extras_require = {
+            'i18n': ['Babel>=0.8'],
+            'plugin': ['setuptools>=0.6a2']
+        },
+        entry_points = """
+        [babel.extractors]
+        genshi = genshi.filters.i18n:extract[i18n]
+
+        [python.templating.engines]
+        genshi = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin]
+        genshi-markup = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin]
+        genshi-text = genshi.template.plugin:TextTemplateEnginePlugin[plugin]
+        """,
+        test_suite = 'genshi.tests.suite',
+        features = {'speedups': speedups}
+    )
 import sys
 
 sys.path.append(os.path.join('doc', 'common'))
@@ -37,34 +64,25 @@
     def run(self):
         try:
             build_ext.run(self)
-        except DistutilsPlatformError:
-            self._unavailable()
+        except DistutilsPlatformError, e:
+            self._unavailable(e)
 
     def build_extension(self, ext):
         try:
             build_ext.build_extension(self, ext)
-        except CCompilerError, x:
-            self._unavailable()
+        except (CCompilerError, DistutilsExecError), e:
+            self._unavailable(e)
 
-    def _unavailable(self):
-        print '*' * 70
-        print """WARNING:
+    def _unavailable(self, e):
+        print >> sys.stderr, '*' * 80
+        print >> sys.stderr, """WARNING:
 An optional C extension could not be compiled, speedups will not be
 available."""
-        print '*' * 70
+        print >> sys.stderr
+        print >> sys.stderr, e
+        print >> sys.stderr, '*' * 80
 
 
-if Feature:
-    speedups = Feature(
-        "optionial C speed-enhancements",
-        standard = True,
-        ext_modules = [
-            Extension('genshi._speedups', ['genshi/_speedups.c']),
-        ],
-    )
-else:
-    speedups = None
-
 setup(
     name = 'Genshi',
     version = '0.5',
@@ -79,7 +97,6 @@
     license = 'BSD',
     url = 'http://genshi.edgewall.org/',
     download_url = 'http://genshi.edgewall.org/wiki/Download',
-    zip_safe = True,
 
     classifiers = [
         'Development Status :: 4 - Beta',
@@ -95,23 +112,8 @@
     ],
     keywords = ['python.templating.engines'],
     packages = ['genshi', 'genshi.filters', 'genshi.template'],
-    test_suite = 'genshi.tests.suite',
 
-    extras_require = {
-        'i18n': ['Babel>=0.8'],
-        'plugin': ['setuptools>=0.6a2']
-    },
-    entry_points = """
-    [babel.extractors]
-    genshi = genshi.filters.i18n:extract[i18n]
-    
-    [python.templating.engines]
-    genshi = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin]
-    genshi-markup = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin]
-    genshi-text = genshi.template.plugin:TextTemplateEnginePlugin[plugin]
-    """,
-
-    features = {'speedups': speedups},
     cmdclass = {'build_doc': build_doc, 'test_doc': test_doc,
-                'build_ext': optional_build_ext}
+                'build_ext': optional_build_ext},
+    **extra
 )
