diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-09-06 13:45:21 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-09-06 13:45:21 -0400 |
commit | bbb481088c030bed9c837068d0a3b956c2e26446 (patch) | |
tree | 8841ac9442867eb0a69e85562cfadb7bd0860434 | |
parent | abf566993bb10869d6003279bff292e0e5044120 (diff) | |
download | external_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-x | setuptools/command/easy_install.py | 17 |
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') |