aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-09-06 13:45:21 -0400
committerJason R. Coombs <jaraco@jaraco.com>2015-09-06 13:45:21 -0400
commitbbb481088c030bed9c837068d0a3b956c2e26446 (patch)
tree8841ac9442867eb0a69e85562cfadb7bd0860434
parentabf566993bb10869d6003279bff292e0e5044120 (diff)
downloadexternal_python_setuptools-bbb481088c030bed9c837068d0a3b956c2e26446.tar.gz
external_python_setuptools-bbb481088c030bed9c837068d0a3b956c2e26446.tar.bz2
external_python_setuptools-bbb481088c030bed9c837068d0a3b956c2e26446.zip
Extract version handling as a separate method
-rwxr-xr-xsetuptools/command/easy_install.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 62c24d77..45d180bb 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -215,12 +215,19 @@ class easy_install(Command):
remover = rmtree if is_tree else os.unlink
remover(path)
+ @staticmethod
+ def _render_version():
+ """
+ Render the Setuptools version and installation details, then exit.
+ """
+ ver = sys.version[:3]
+ dist = get_distribution('setuptools')
+ tmpl = 'setuptools {dist.version} from {dist.location} (Python {ver})'
+ print(tmpl.format(**locals()))
+ raise SystemExit()
+
def finalize_options(self):
- if self.version:
- dist = get_distribution('setuptools')
- print('setuptools %s from %s (python %s)' % (
- dist.version, dist.location, sys.version[:3]))
- sys.exit()
+ self.version and self._render_version()
py_version = sys.version.split()[0]
prefix, exec_prefix = get_config_vars('prefix', 'exec_prefix')