From bbb481088c030bed9c837068d0a3b956c2e26446 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 6 Sep 2015 13:45:21 -0400 Subject: Extract version handling as a separate method --- setuptools/command/easy_install.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'setuptools/command/easy_install.py') 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') -- cgit v1.2.3