diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-04 11:35:16 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-04 11:35:16 -0500 |
commit | 9d6a6e5927ae0e67164383e419f3145fc154467e (patch) | |
tree | 8872d8b6de4c8706a5178dcb3dab2c9803216e59 /setuptools/command | |
parent | a849ee957f3ba12945278f88e473eb3612faf4b9 (diff) | |
download | external_python_setuptools-9d6a6e5927ae0e67164383e419f3145fc154467e.tar.gz external_python_setuptools-9d6a6e5927ae0e67164383e419f3145fc154467e.tar.bz2 external_python_setuptools-9d6a6e5927ae0e67164383e419f3145fc154467e.zip |
Use except/as, now supported by Python 2.6
Diffstat (limited to 'setuptools/command')
-rwxr-xr-x | setuptools/command/easy_install.py | 12 | ||||
-rwxr-xr-x | setuptools/command/sdist.py | 3 | ||||
-rw-r--r-- | setuptools/command/upload_docs.py | 3 |
3 files changed, 7 insertions, 11 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 1a2f56ae..02ce7636 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -698,13 +698,11 @@ Please make the appropriate changes for your system and try again. distros = WorkingSet([]).resolve( [requirement], self.local_index, self.easy_install ) - except DistributionNotFound: - e = sys.exc_info()[1] + except DistributionNotFound as e: raise DistutilsError( "Could not find required distribution %s" % e.args ) - except VersionConflict: - e = sys.exc_info()[1] + except VersionConflict as e: raise DistutilsError( "Installed distribution %s conflicts with requirement %s" % e.args @@ -1044,8 +1042,7 @@ See the setuptools documentation for the "develop" command for more info. ) try: run_setup(setup_script, args) - except SystemExit: - v = sys.exc_info()[1] + except SystemExit as v: raise DistutilsError("Setup script exited with %s" % (v.args[0],)) def build_and_install(self, setup_script, setup_base): @@ -1889,8 +1886,7 @@ def chmod(path, mode): log.debug("changing mode of %s to %o", path, mode) try: _chmod(path, mode) - except os.error: - e = sys.exc_info()[1] + except os.error as e: log.debug("chmod failed: %s", e) diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 3d33df80..851a1775 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -70,7 +70,8 @@ class sdist(orig.sdist): try: orig.sdist.read_template(self) except: - sys.exc_info()[2].tb_next.tb_frame.f_locals['template'].close() + _, _, tb = sys.exc_info() + tb.tb_next.tb_frame.f_locals['template'].close() raise # Beginning with Python 2.7.2, 3.1.4, and 3.2.1, this leaky file handle diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index cd6c300c..001ee936 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -169,8 +169,7 @@ class upload_docs(upload): conn.putheader('Authorization', auth) conn.endheaders() conn.send(body) - except socket.error: - e = sys.exc_info()[1] + except socket.error as e: self.announce(str(e), log.ERROR) return |