]> granicus.if.org Git - python/commitdiff
Just pointed out the code was better written with
authorNeal Norwitz <nnorwitz@gmail.com>
Fri, 28 Feb 2003 17:39:42 +0000 (17:39 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Fri, 28 Feb 2003 17:39:42 +0000 (17:39 +0000)
        try: # ...
        except ImportError, why:
        except: # ...
All other changes are re-indenting/formatting.

setup.py

index 7c362f55cda8990866cd4d531a810c53fb8587f0..f0276c3d6a01ec6ed16d13eba7a3f037b92a0dea 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -207,33 +207,32 @@ class PyBuildExt(build_ext):
             self.get_ext_filename(self.get_ext_fullname(ext.name)))
         try:
             imp.load_dynamic(ext.name, ext_filename)
+        except ImportError, why:
+            self.announce('*** WARNING: renaming "%s" since importing it'
+                          ' failed: %s' % (ext.name, why), level=3)
+            assert not self.inplace
+            basename, tail = os.path.splitext(ext_filename)
+            newname = basename + "_failed" + tail
+            if os.path.exists(newname):
+                os.remove(newname)
+            os.rename(ext_filename, newname)
+
+            # XXX -- This relies on a Vile HACK in
+            # distutils.command.build_ext.build_extension().  The
+            # _built_objects attribute is stored there strictly for
+            # use here.
+            # If there is a failure, _built_objects may not be there,
+            # so catch the AttributeError and move on.
+            try:
+                for filename in self._built_objects:
+                    os.remove(filename)
+            except AttributeError:
+                self.announce('unable to remove files (ignored)')
         except:
-
             exc_type, why, tb = sys.exc_info()
-            if issubclass(exc_type, ImportError):
-                self.announce('*** WARNING: renaming "%s" since importing it'
-                              ' failed: %s' % (ext.name, why), level=3)
-                assert not self.inplace
-                basename, tail = os.path.splitext(ext_filename)
-                newname = basename + "_failed" + tail
-                if os.path.exists(newname): os.remove(newname)
-                os.rename(ext_filename, newname)
-
-                # XXX -- This relies on a Vile HACK in
-                # distutils.command.build_ext.build_extension().  The
-                # _built_objects attribute is stored there strictly for
-                # use here.
-                # If there is a failure, _built_objects may not be there,
-                # so catch the AttributeError and move on.
-                try:
-                    for filename in self._built_objects:
-                        os.remove(filename)
-                except AttributeError:
-                    self.announce('unable to remove files (ignored)')
-            else:
-                self.announce('*** WARNING: importing extension "%s" '
-                              'failed with %s: %s' % (ext.name, exc_type, why),
-                              level=3)
+            self.announce('*** WARNING: importing extension "%s" '
+                          'failed with %s: %s' % (ext.name, exc_type, why),
+                          level=3)
 
     def get_platform (self):
         # Get value of sys.platform