mirror of https://github.com/python/cpython
Just pointed out the code was better written with
try: # ... except ImportError, why: except: # ... All other changes are re-indenting/formatting.
This commit is contained in:
parent
2c92c6e1f4
commit
6e2d1c7ab8
11
setup.py
11
setup.py
|
@ -207,16 +207,14 @@ class PyBuildExt(build_ext):
|
||||||
self.get_ext_filename(self.get_ext_fullname(ext.name)))
|
self.get_ext_filename(self.get_ext_fullname(ext.name)))
|
||||||
try:
|
try:
|
||||||
imp.load_dynamic(ext.name, ext_filename)
|
imp.load_dynamic(ext.name, ext_filename)
|
||||||
except:
|
except ImportError, why:
|
||||||
|
|
||||||
exc_type, why, tb = sys.exc_info()
|
|
||||||
if issubclass(exc_type, ImportError):
|
|
||||||
self.announce('*** WARNING: renaming "%s" since importing it'
|
self.announce('*** WARNING: renaming "%s" since importing it'
|
||||||
' failed: %s' % (ext.name, why), level=3)
|
' failed: %s' % (ext.name, why), level=3)
|
||||||
assert not self.inplace
|
assert not self.inplace
|
||||||
basename, tail = os.path.splitext(ext_filename)
|
basename, tail = os.path.splitext(ext_filename)
|
||||||
newname = basename + "_failed" + tail
|
newname = basename + "_failed" + tail
|
||||||
if os.path.exists(newname): os.remove(newname)
|
if os.path.exists(newname):
|
||||||
|
os.remove(newname)
|
||||||
os.rename(ext_filename, newname)
|
os.rename(ext_filename, newname)
|
||||||
|
|
||||||
# XXX -- This relies on a Vile HACK in
|
# XXX -- This relies on a Vile HACK in
|
||||||
|
@ -230,7 +228,8 @@ class PyBuildExt(build_ext):
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.announce('unable to remove files (ignored)')
|
self.announce('unable to remove files (ignored)')
|
||||||
else:
|
except:
|
||||||
|
exc_type, why, tb = sys.exc_info()
|
||||||
self.announce('*** WARNING: importing extension "%s" '
|
self.announce('*** WARNING: importing extension "%s" '
|
||||||
'failed with %s: %s' % (ext.name, exc_type, why),
|
'failed with %s: %s' % (ext.name, exc_type, why),
|
||||||
level=3)
|
level=3)
|
||||||
|
|
Loading…
Reference in New Issue