Commit e0243660 authored by Zen Fu's avatar Zen Fu
Browse files

[weblate] Improve parsing of extra requirements (tails#17377)

Extra dependencies are listed in the Pypi JSON with the keyword "extra",
as such (example taken from https://pypi.org/pypi/celery/json):

    "cryptography ; extra == 'auth'",

This means that someone can run `pip install celery[auth]` and will get
the cryptography package installed.

But this scheme also allows for variations, as the following (from the
same URL as above):

    "couchbase-cffi (<3.0.0) ; (platform_python_implementation == \"PyPy\") and extra == 'couchbase'",

The current implementation of detection of "extra" dependencies does not
account for the second format, so I'm fixing it in this commit.
parent fe843483
......@@ -241,7 +241,7 @@ class Dependency:
for i in self.pypi()['info']['requires_dist']:
if "; extra == 'redis'" in i:
i = i[:i.find("; extra")].strip()
if "; extra" in i:
if " extra ==" in i:
continue
dep = Dependency(i, self.config, split=False)
if via_pip and dep.name not in via_pip:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment