Skip to content

Commit

Permalink
fix: Broken version command
Browse files Browse the repository at this point in the history
  • Loading branch information
sijis committed Jan 31, 2019
1 parent 193666f commit 7b76a21
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/lavatory/__main__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"""Main entry point."""
import logging
import pprint

import click
import coloredlogs
import pip

from .commands.policies import policies
from .commands.purge import purge
Expand All @@ -31,18 +29,9 @@ def root(ctx, verbose):
@root.command()
def version():
"""Print version information."""
for package_info in pip.commands.show.search_packages_info([__package__]):
LOG.debug('Full package info: %s', pprint.pformat(package_info))

name = package_info['name']
if name != __package__:
LOG.debug('This is not the package you are looking for: %s', name)
continue

click.echo(package_info['version'])
break
else:
raise KeyError('Could not find {0}'.format(__package__))
import pkg_resources
lavatory_version = pkg_resources.get_distribution('lavatory').version
click.echo(lavatory_version)


root.add_command(policies)
Expand Down

0 comments on commit 7b76a21

Please sign in to comment.