locate.run_requires fails for some packages

Issue #98 resolved
Cody Scott
created an issue

caniusepython3 fails for some packages.

For example

caniusepython3 --projects bpython

It is doing this

import distlib.locators

a = distlib.locators.locate('bpython', prereleases=True)

a.run_requires
Traceback (most recent call last):
  File "bug.py", line 5, in <module>
    a.run_requires
  File "/home/siecje/venv/lib/python3.5/site-packages/distlib/database.py", line 381, in run_requires
    return self._get_requirements('run_requires')
  File "/home/siecje/venv/lib/python3.5/site-packages/distlib/database.py", line 377, in _get_requirements
    env=self.context))
  File "/home/siecje/venv/lib/python3.5/site-packages/distlib/metadata.py", line 882, in get_requirements
    include = interpret(marker, env)
  File "/home/siecje/venv/lib/python3.5/site-packages/distlib/markers.py", line 122, in interpret
    expr, rest = parse_marker(marker)
  File "/home/siecje/venv/lib/python3.5/site-packages/distlib/util.py", line 142, in parse_marker
    return marker(marker_string)
  File "/home/siecje/venv/lib/python3.5/site-packages/distlib/util.py", line 138, in marker
    rhs, remaining = marker_and(remaining)
  File "/home/siecje/venv/lib/python3.5/site-packages/distlib/util.py", line 121, in marker_and
    lhs, remaining = marker_expr(remaining)
  File "/home/siecje/venv/lib/python3.5/site-packages/distlib/util.py", line 115, in marker_expr
    rhs, remaining = marker_var(remaining)
  File "/home/siecje/venv/lib/python3.5/site-packages/distlib/util.py", line 95, in marker_var
    raise SyntaxError('unterminated string: %s' % s)
SyntaxError: unterminated string: "2

Stepping through it, it runs distlib.util.parse_marker a couple of times starting with

>>> remaining
('or python_full_version == "2.7.1" or python_full_version == "2.7.2" or '
 'python_full_version == "2')

But since it doesn't end in " it fails.

Comments (2)

  1. Vinay Sajip

    This should now work, for bpython at least. The problem was in the metadata. If you run into any other projects with the same problem, please reopen the issue with more info.

    $ python
    Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
    [GCC 5.4.0 20160609] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from distlib.locators import locate; d = locate('bpython', prereleases=True)
    >>> d.run_requires
    set([u'greenlet', u'requests', u'pygments', u'curtsies (>= 0.1.18)', u'six (>= 1.5)'])
    >>> 
    
  2. Log in to comment