Add --no-deps-only option to CHANGES.txt and fix lint warnings.

This commit is contained in:
nvdv 2016-09-28 11:18:37 +03:00
parent e0b23e9ce3
commit 60429a6e79
2 changed files with 10 additions and 5 deletions

View File

@ -14,6 +14,9 @@
* Added optional column formatting to ``pip list`` (:issue:`3651`).
* Add `--no-deps-only` option to ``pip list`` to list packages that are
not dependencies of other packages.
* Fix the build on systems with symlinked /tmp directory for custom
builds such as numpy.

View File

@ -95,7 +95,8 @@ class ListCommand(Command):
'--no-deps-only',
action='store_true',
dest='nodeps_only',
help="List packages that are not dependencies of installed packages.",
help="List packages that are not dependencies of "
"installed packages.",
)
index_opts = make_option_group(index_group, self.parser)
@ -182,12 +183,13 @@ class ListCommand(Command):
]
def get_nodeps_only(self, packages, options):
installed_packages = [
dist for dist in self.iter_packages_latest_infos(packages, options)]
installed_pkgs = [
dist for dist in self.iter_packages_latest_infos(packages, options)
]
dep_keys = set()
for dist in installed_packages:
for dist in installed_pkgs:
dep_keys.update(requirement.key for requirement in dist.requires())
return set(pkg for pkg in installed_packages if pkg.key not in dep_keys)
return set(pkg for pkg in installed_pkgs if pkg.key not in dep_keys)
def iter_packages_latest_infos(self, packages, options):
index_urls = [options.index_url] + options.extra_index_urls