Commit bbb48108 authored by Jason R. Coombs's avatar Jason R. Coombs

Extract version handling as a separate method

parent abf56699
...@@ -215,12 +215,19 @@ class easy_install(Command): ...@@ -215,12 +215,19 @@ class easy_install(Command):
remover = rmtree if is_tree else os.unlink remover = rmtree if is_tree else os.unlink
remover(path) 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): def finalize_options(self):
if self.version: self.version and self._render_version()
dist = get_distribution('setuptools')
print('setuptools %s from %s (python %s)' % (
dist.version, dist.location, sys.version[:3]))
sys.exit()
py_version = sys.version.split()[0] py_version = sys.version.split()[0]
prefix, exec_prefix = get_config_vars('prefix', 'exec_prefix') prefix, exec_prefix = get_config_vars('prefix', 'exec_prefix')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment