from '--editables' to --editable' and some minor formatting

This commit is contained in:
Marcus Smith 2012-12-19 22:08:56 -08:00
parent 7879e70963
commit c49f7e0fb2
2 changed files with 9 additions and 8 deletions

View File

@ -30,7 +30,7 @@ class ListCommand(Command):
default=False,
help='List uptodate packages (excluding editables)')
cmd_opts.add_option(
'-e', '--editables',
'-e', '--editable',
action='store_true',
default=False,
help='List editable packages.')
@ -61,7 +61,7 @@ class ListCommand(Command):
self.run_outdated(options)
elif options.uptodate:
self.run_uptodate(options)
elif options.editables:
elif options.editable:
self.run_editables(options)
else:
self.run_listing(options)
@ -69,7 +69,7 @@ class ListCommand(Command):
def run_outdated(self, options):
for dist, remote_version_raw, remote_version_parsed in self.find_packages_latests_versions(options):
if remote_version_parsed > dist.parsed_version:
logger.notify('%s (CURRENT: %s LATEST: %s)' % (dist.project_name,
logger.notify('%s (Current: %s Latest: %s)' % (dist.project_name,
dist.version, remote_version_raw))
def find_packages_latests_versions(self, options):
@ -119,9 +119,10 @@ class ListCommand(Command):
def output_package_listing(self, installed_packages):
for dist in installed_packages:
line = '%s (%s)' % (dist.project_name, dist.version)
if dist_is_editable(dist):
line += ' editable src at %s' % dist.location
line = '%s (%s, %s)' % (dist.project_name, dist.version, dist.location)
else:
line = '%s (%s)' % (dist.project_name, dist.version)
logger.notify(line)
def run_uptodate(self, options):

View File

@ -63,9 +63,9 @@ def test_outdated_flag():
result = run_pip('search', 'INITools')
initools_ver = total_re.search(str(result)).group(1)
result = run_pip('list', '--outdated', expect_stderr=True)
assert 'INITools (CURRENT: 0.2 LATEST: %s)' % initools_ver in result.stdout, str(result)
assert 'INITools (Current: 0.2 Latest: %s)' % initools_ver in result.stdout, str(result)
assert 'pip-test-package' not in result.stdout #editables excluded
assert 'mock (CURRENT: 0.7.0 LATEST: %s)' % mock_ver in result.stdout, str(result)
assert 'mock (Current: 0.7.0 Latest: %s)' % mock_ver in result.stdout, str(result)
def test_editables_flag():
@ -75,7 +75,7 @@ def test_editables_flag():
reset_env()
run_pip('install', 'mock==0.7.0')
result = run_pip('install', '-e', 'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package')
result = run_pip('list', '--editables')
result = run_pip('list', '--editable')
assert 'mock (0.7.0)' not in result.stdout, str(result)
assert 'src/pip-test-package' in result.stdout, str(result)