[Python-modules-commits] [python-pip] 09/11: Warn and skip broken requirements.

Barry Warsaw barry at moszumanska.debian.org
Thu Jun 16 14:15:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

barry pushed a commit to branch master
in repository python-pip.

commit a20c5a09204cc0f44a857d8913610e23ed41449a
Author: Barry Warsaw <barry at python.org>
Date:   Thu Jun 16 15:29:12 2016 +0300

    Warn and skip broken requirements.
    
    Description: Warn and skip broken requirements.
    Origin: https://github.com/pypa/pip/pull/3704
    Bug: https://github.com/pypa/pip/issues/3681
    Forwarded: not-needed
    
    Patch-Name: skip-bad-requirements.patch
---
 pip/operations/freeze.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/pip/operations/freeze.py b/pip/operations/freeze.py
index 086922e..7493ced 100644
--- a/pip/operations/freeze.py
+++ b/pip/operations/freeze.py
@@ -8,6 +8,7 @@ from pip.req import InstallRequirement
 from pip.utils import get_installed_distributions
 from pip._vendor import pkg_resources
 from pip._vendor.packaging.utils import canonicalize_name
+from pip._vendor.pkg_resources import RequirementParseError
 
 
 logger = logging.getLogger(__name__)
@@ -42,10 +43,17 @@ def freeze(
     for dist in get_installed_distributions(local_only=local_only,
                                             skip=(),
                                             user_only=user_only):
-        req = pip.FrozenRequirement.from_dist(
-            dist,
-            dependency_links
-        )
+        try:
+            req = pip.FrozenRequirement.from_dist(
+                dist,
+                dependency_links
+            )
+        except RequirementParseError:
+            logger.warning(
+                "Could not parse requirement: %s",
+                dist.project_name
+            )
+            continue
         installations[req.name] = req
 
     if requirement:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pip.git



More information about the Python-modules-commits mailing list