Commit 9c63f78b by Sébastien Eustace

Fix handling of extras and constraints for legacy repositories

parent 0970878e
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
- Fixed extras being selected when resolving dependencies even when not required. - Fixed extras being selected when resolving dependencies even when not required.
- Fixed performance issues when packaging projects if a lot of files were excluded. - Fixed performance issues when packaging projects if a lot of files were excluded.
- Fixed installation of files. - Fixed installation of files.
- Fixed extras not being retrieved for legacy repositories.
- Fixed invalid transitive constraints raising an error for legacy repositories.
## [0.12.6] - 2018-11-05 ## [0.12.6] - 2018-11-05
......
...@@ -266,9 +266,17 @@ class LegacyRepository(PyPiRepository): ...@@ -266,9 +266,17 @@ class LegacyRepository(PyPiRepository):
req = req.split(";")[0] req = req.split(";")[0]
dependency = dependency_from_pep_508(req) dependency = dependency_from_pep_508(req)
except ValueError:
# Likely unable to parse constraint so we skip it
self._log(
"Invalid constraint ({}) found in {}-{} dependencies, "
"skipping".format(req, package.name, package.version),
level="debug",
)
continue
if dependency.extras: if dependency.in_extras:
for extra in dependency.extras: for extra in dependency.in_extras:
if extra not in package.extras: if extra not in package.extras:
package.extras[extra] = [] package.extras[extra] = []
......
<!DOCTYPE html>
<html>
<head>
<title>Links for python-language-server</title>
</head>
<body>
<h1>Links for python-language-server</h1>
<a href="https://files.pythonhosted.org/packages/9f/1d/2817b5dc2dd77f897410a11c1c9e2a6d96b3273c53d4219dd9edab7882af/python-language-server-0.21.2.tar.gz#sha256=fa9162acb1402b807132d7288b7f521db2bd666d63505d8a4d9464d4b8488c52">python-language-server-0.21.2.tar.gz</a><br/>
</body>
</html>
<!--SERIAL 4245719-->
...@@ -67,7 +67,7 @@ def test_sdist_format_support(): ...@@ -67,7 +67,7 @@ def test_sdist_format_support():
assert bz2_links[0].filename == "poetry-0.1.1.tar.bz2" assert bz2_links[0].filename == "poetry-0.1.1.tar.bz2"
def test_missing_version(mocker): def test_missing_version():
repo = MockRepository() repo = MockRepository()
with pytest.raises(PackageNotFound): with pytest.raises(PackageNotFound):
...@@ -95,3 +95,36 @@ def test_get_package_information_fallback_read_setup(): ...@@ -95,3 +95,36 @@ def test_get_package_information_fallback_read_setup():
Dependency("ipykernel", "*"), Dependency("ipykernel", "*"),
Dependency("ipywidgets", "*"), Dependency("ipywidgets", "*"),
] ]
def test_get_package_information_skips_dependencies_with_invalid_constraints():
repo = MockRepository()
package = repo.package("python-language-server", "0.21.2")
assert package.name == "python-language-server"
assert package.version.text == "0.21.2"
assert (
package.description == "Python Language Server for the Language Server Protocol"
)
assert sorted(package.requires, key=lambda r: r.name) == [
Dependency("configparser", "*"),
Dependency("future", ">=0.14.0"),
Dependency("futures", "*"),
Dependency("jedi", ">=0.12"),
Dependency("pluggy", "*"),
Dependency("python-jsonrpc-server", "*"),
]
all_extra = package.extras["all"]
# rope>-0.10.5 should be discarded
assert sorted(all_extra, key=lambda r: r.name) == [
Dependency("autopep8", "*"),
Dependency("mccabe", "*"),
Dependency("pycodestyle", "*"),
Dependency("pydocstyle", ">=2.0.0"),
Dependency("pyflakes", ">=1.6.0"),
Dependency("yapf", "*"),
]
Markdown is supported
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