Commit 5acb920d by Sébastien Eustace

Fix the solver picking up unnecessary dependencies

This is due to the fact the the python_full_version marker was not being used
parent 49846247
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
- Fixed installation of Poetry git dependencies with a build system. - Fixed installation of Poetry git dependencies with a build system.
- Fixed possible errors when resolving dependencies for specific packages. - Fixed possible errors when resolving dependencies for specific packages.
- Fixed handling of Python versions compatibility. - Fixed handling of Python versions compatibility.
- Fixed the dependency resolver picking up unnecessary dependencies due to not using the `python_full_version` marker.
## [0.12.4] - 2018-10-21 ## [0.12.4] - 2018-10-21
......
...@@ -146,6 +146,12 @@ def convert_markers(marker): ...@@ -146,6 +146,12 @@ def convert_markers(marker):
else: else:
variable, op, value = group variable, op, value = group
group_name = str(variable) group_name = str(variable)
# python_full_version is equivalent to python_version
# for Poetry so we merge them
if group_name == "python_full_version":
group_name = "python_version"
if group_name not in requirements: if group_name not in requirements:
requirements[group_name] = [] requirements[group_name] = []
......
...@@ -1192,3 +1192,35 @@ def test_solver_should_not_resolve_prerelease_version_if_not_requested( ...@@ -1192,3 +1192,35 @@ def test_solver_should_not_resolve_prerelease_version_if_not_requested(
with pytest.raises(SolverProblemError): with pytest.raises(SolverProblemError):
solver.solve() solver.solve()
def test_solver_ignores_dependencies_with_incompatible_python_full_version_marker(
solver, repo, package
):
package.python_versions = "^3.6"
package.add_dependency("A", "^1.0")
package.add_dependency("B", "^2.0")
package_a = get_package("A", "1.0.0")
package_a.requires.append(
dependency_from_pep_508(
'B (<2.0); platform_python_implementation == "PyPy" and python_full_version < "2.7.9"'
)
)
package_b200 = get_package("B", "2.0.0")
package_b100 = get_package("B", "1.0.0")
repo.add_package(package_a)
repo.add_package(package_b100)
repo.add_package(package_b200)
ops = solver.solve()
check_solver_result(
ops,
[
{"job": "install", "package": package_a},
{"job": "install", "package": package_b200},
],
)
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