Hello community,

here is the log from the commit of package python-pip-api for openSUSE:Factory 
checked in at 2019-05-20 10:28:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pip-api (Old)
 and      /work/SRC/openSUSE:Factory/.python-pip-api.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pip-api"

Mon May 20 10:28:14 2019 rev:2 rq:703785 version:0.0.8

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pip-api/python-pip-api.changes    
2019-02-28 21:42:43.717542390 +0100
+++ /work/SRC/openSUSE:Factory/.python-pip-api.new.5148/python-pip-api.changes  
2019-05-20 10:28:18.237918112 +0200
@@ -1,0 +2,9 @@
+Fri May 17 19:43:12 UTC 2019 - Hardik Italia <hita...@suse.com>
+
+- Update to 0.0.8:
+  * Handle editable installs
+  * Ignore index url parameters in parse_requirements
+  * Drop support for Python 3.4
+  * Add support for pip 19.0, 19.0.1, 19.0.2, 19.0.3
+
+-------------------------------------------------------------------

Old:
----
  pip-api-0.0.5.tar.gz

New:
----
  pip-api-0.0.8.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pip-api.spec ++++++
--- /var/tmp/diff_new_pack.CmtDma/_old  2019-05-20 10:28:18.697917960 +0200
+++ /var/tmp/diff_new_pack.CmtDma/_new  2019-05-20 10:28:18.697917960 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-pip-api
-Version:        0.0.5
+Version:        0.0.8
 Release:        0
 Summary:        The official unofficial pip API
 License:        Apache-2.0

++++++ pip-api-0.0.5.tar.gz -> pip-api-0.0.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pip-api-0.0.5/PKG-INFO new/pip-api-0.0.8/PKG-INFO
--- old/pip-api-0.0.5/PKG-INFO  2019-02-21 23:46:07.000000000 +0100
+++ new/pip-api-0.0.8/PKG-INFO  2019-05-06 18:30:24.000000000 +0200
@@ -1,7 +1,7 @@
 Metadata-Version: 2.1
 Name: pip-api
-Version: 0.0.5
-Summary: The official unofficial pip API
+Version: 0.0.8
+Summary: An unofficial, importable pip API
 Home-page: http://github.com/di/pip-api
 Author: Dustin Ingram
 Author-email: di@di.codes
@@ -51,9 +51,8 @@
 Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
-Requires-Python: >=2.7,!=3.0,!=3.1,!=3.2,!=3.3
+Requires-Python: >=2.7,!=3.0,!=3.1,!=3.2,!=3.3,!=3.4
 Description-Content-Type: text/markdown
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pip-api-0.0.5/pip_api/_parse_requirements.py 
new/pip-api-0.0.8/pip_api/_parse_requirements.py
--- old/pip-api-0.0.5/pip_api/_parse_requirements.py    2018-10-25 
21:34:54.000000000 +0200
+++ new/pip-api-0.0.8/pip_api/_parse_requirements.py    2019-05-06 
17:33:10.000000000 +0200
@@ -1,4 +1,5 @@
 import argparse
+import ast
 import os
 import re
 import traceback
@@ -20,6 +21,10 @@
 parser.add_argument("req", nargs="?")
 parser.add_argument("-r", "--requirements")
 parser.add_argument("-e", "--editable")
+# Consume index url params to avoid trying to treat them as packages.
+parser.add_argument("-i", "--index-url")
+parser.add_argument("--extra-index-url")
+parser.add_argument("-f", "--find-links")
 
 operators = packaging.specifiers.Specifier._operators.keys()
 
@@ -71,6 +76,26 @@
     return url
 
 
+def _parse_local_package_name(path):
+    '''Tokenize setup.py and walk the syntax tree to find the package name'''
+    try:
+        with open(os.path.join(path, 'setup.py')) as f:
+            tree = ast.parse(f.read())
+        setup_kwargs = [
+            expr.value.keywords for expr in tree.body
+            if isinstance(expr, ast.Expr) and isinstance(expr.value, ast.Call)
+            and expr.value.func.id == 'setup'
+        ][0]
+        value = [kw.value for kw in setup_kwargs if kw.arg == 'name'][0]
+        return value.s
+    except (IndexError, AttributeError, IOError, OSError):
+        raise PipError(
+            "Directory %r is not installable. "
+            "Could not parse package name from 'setup.py'." %
+            path
+        )
+
+
 def _parse_editable(editable_req):
     url = editable_req
 
@@ -87,7 +112,7 @@
         url_no_extras = _path_to_url(url_no_extras)
 
     if url_no_extras.lower().startswith('file:'):
-        return
+        return _parse_local_package_name(url_no_extras[len('file://'):]), 
url_no_extras
 
     if '+' not in url:
         raise PipError(
@@ -103,6 +128,8 @@
             "with #egg=your_package_name" % editable_req
         )
 
+    return package_name, url
+
 
 def _filterfalse(predicate, iterable):
     if predicate is None:
@@ -147,6 +174,7 @@
         lines_enum = _skip_regex(lines_enum, options)
 
         for lineno, line in lines_enum:
+            req = None
             known, _ = parser.parse_known_args(line.strip().split())
             if known.req:
                 try:  # Try to parse this as a requirement specification
@@ -154,6 +182,17 @@
                 except packaging.requirements.InvalidRequirement:
                     _check_invalid_requirement(known.req)
 
+            elif known.requirements:
+                if known.requirements not in parsed:
+                    to_parse.add(known.requirements)
+            elif known.editable:
+                name, url = _parse_editable(known.editable)
+                req = packaging.requirements.Requirement("%s @ %s" % (name, 
url))
+            else:
+                pass  # This is an invalid requirement
+
+            # If we've found a requirement, add it
+            if req:
                 req.comes_from = "-r {} (line {})".format(filename, lineno)
                 if req.name not in name_to_req:
                     name_to_req[req.name.lower()] = req
@@ -162,12 +201,5 @@
                         "Double requirement given: %s (already in %s, name=%r)"
                         % (req, name_to_req[req.name], req.name)
                     )
-            elif known.requirements:
-                if known.requirements not in parsed:
-                    to_parse.add(known.requirements)
-            elif known.editable:
-                _parse_editable(known.editable)
-            else:
-                pass  # This is an invalid requirement
 
     return name_to_req
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pip-api-0.0.5/pip_api.egg-info/PKG-INFO 
new/pip-api-0.0.8/pip_api.egg-info/PKG-INFO
--- old/pip-api-0.0.5/pip_api.egg-info/PKG-INFO 2019-02-21 23:46:07.000000000 
+0100
+++ new/pip-api-0.0.8/pip_api.egg-info/PKG-INFO 2019-05-06 18:30:24.000000000 
+0200
@@ -1,7 +1,7 @@
 Metadata-Version: 2.1
 Name: pip-api
-Version: 0.0.5
-Summary: The official unofficial pip API
+Version: 0.0.8
+Summary: An unofficial, importable pip API
 Home-page: http://github.com/di/pip-api
 Author: Dustin Ingram
 Author-email: di@di.codes
@@ -51,9 +51,8 @@
 Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
-Requires-Python: >=2.7,!=3.0,!=3.1,!=3.2,!=3.3
+Requires-Python: >=2.7,!=3.0,!=3.1,!=3.2,!=3.3,!=3.4
 Description-Content-Type: text/markdown
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pip-api-0.0.5/setup.py new/pip-api-0.0.8/setup.py
--- old/pip-api-0.0.5/setup.py  2019-02-21 23:44:07.000000000 +0100
+++ new/pip-api-0.0.8/setup.py  2019-05-06 18:28:54.000000000 +0200
@@ -11,19 +11,18 @@
         "Programming Language :: Python :: 2",
         "Programming Language :: Python :: 2.7",
         "Programming Language :: Python :: 3",
-        "Programming Language :: Python :: 3.4",
         "Programming Language :: Python :: 3.5",
         "Programming Language :: Python :: 3.6",
         "Programming Language :: Python :: 3.7",
     ],
-    description='The official unofficial pip API',
+    description='An unofficial, importable pip API',
     install_requires=['packaging>=16.1', 'pip'],
     long_description=long_description,
     long_description_content_type='text/markdown',
     name='pip-api',
     packages=['pip_api'],
-    python_requires='>=2.7,!=3.0,!=3.1,!=3.2,!=3.3',
+    python_requires='>=2.7,!=3.0,!=3.1,!=3.2,!=3.3,!=3.4',
     url='http://github.com/di/pip-api',
-    summary='The official unofficial pip API',
-    version='0.0.5',
+    summary='An unofficial, importable pip API',
+    version='0.0.8',
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pip-api-0.0.5/tests/test_parse_requirements.py 
new/pip-api-0.0.8/tests/test_parse_requirements.py
--- old/pip-api-0.0.5/tests/test_parse_requirements.py  2018-10-25 
21:34:54.000000000 +0200
+++ new/pip-api-0.0.8/tests/test_parse_requirements.py  2019-05-06 
17:33:10.000000000 +0200
@@ -32,6 +32,24 @@
     assert str(result['foo']) == 'foo==1.2.3'
 
 
+@pytest.mark.parametrize(
+    'flag', ['-i', '--index-url', '--extra-index-url', '-f', '--find-links']
+)
+def test_parse_requirements_with_index_url(monkeypatch, flag):
+    files = {
+        'a.txt': [
+            '{} https://example.com/pypi/simple\n'.format(flag),
+            'foo==1.2.3\n',
+        ],
+    }
+    monkeypatch.setattr(pip_api._parse_requirements, '_read_file', files.get)
+
+    result = pip_api.parse_requirements('a.txt')
+
+    assert set(result) == {'foo'}
+    assert str(result['foo']) == 'foo==1.2.3'
+
+
 @pytest.mark.parametrize('flag', ['-r', '--requirements'])
 def test_parse_requirements_recursive(monkeypatch, flag):
     files = {
@@ -84,3 +102,35 @@
 
     assert set(result) == {'foo'}
     assert str(result['foo']) == 'foo==1.2.3'
+
+
+def test_parse_requirements_editable(monkeypatch):
+    files = {
+        'a.txt': [
+            "Django==1.11\n"
+            "-e git+https://github.com/foo/deal.git#egg=deal\n";
+        ],
+    }
+    monkeypatch.setattr(pip_api._parse_requirements, '_read_file', files.get)
+
+    result = pip_api.parse_requirements('a.txt')
+
+    assert set(result) == {'django', 'deal'}
+    assert str(result['django']) == 'Django==1.11'
+    assert str(result['deal']) == 'deal@ 
git+https://github.com/foo/deal.git#egg=deal'
+
+
+def test_parse_requirements_editable_file(monkeypatch):
+    files = {
+        'a.txt': [
+            "Django==1.11\n"
+            "-e .\n"
+        ],
+    }
+    monkeypatch.setattr(pip_api._parse_requirements, '_read_file', files.get)
+
+    result = pip_api.parse_requirements('a.txt')
+
+    assert set(result) == {'django', 'pip-api'}
+    assert str(result['django']) == 'Django==1.11'
+    assert str(result['pip-api']).startswith('pip-api@ file:///')


Reply via email to