From 60429a6e79b9a12b6c08853b1c18f31c20ffc0ee Mon Sep 17 00:00:00 2001 From: nvdv Date: Wed, 28 Sep 2016 11:18:37 +0300 Subject: [PATCH] Add --no-deps-only option to CHANGES.txt and fix lint warnings. --- CHANGES.txt | 3 +++ pip/commands/list.py | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index f96bbc08e..ea02d79e2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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. diff --git a/pip/commands/list.py b/pip/commands/list.py index 08cd5585f..d987223da 100644 --- a/pip/commands/list.py +++ b/pip/commands/list.py @@ -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