Commit ad40e5bc by Sébastien Eustace Committed by GitHub

Fix an invalid git url error when solving with installed and locked git depednencies (#1576)

parent 4f1b0f8a
......@@ -62,6 +62,9 @@ class Solver:
pkg_source_url = Git.normalize_url(pkg.source_url)
package_source_url = Git.normalize_url(package.source_url)
for locked in self._locked.packages:
if locked.name != pkg.name or locked.source_type != "git":
continue
locked_source_url = Git.normalize_url(locked.source_url)
if (
locked.name == pkg.name
......
......@@ -1856,3 +1856,34 @@ def test_solver_does_not_loop_indefinitely_on_duplicate_constraints_with_extras(
ops,
[{"job": "install", "package": idna}, {"job": "install", "package": requests}],
)
def test_solver_does_not_fail_with_locked_git_and_non_git_dependencies(
solver, repo, package, locked, pool, installed, io
):
package.add_dependency("demo", {"git": "https://github.com/demo/demo.git"})
package.add_dependency("a", "^1.2.3")
git_package = get_package("demo", "0.1.2")
git_package.source_type = "git"
git_package.source_url = "https://github.com/demo/demo.git"
git_package.source_reference = "commit"
installed.add_package(git_package)
locked.add_package(get_package("a", "1.2.3"))
locked.add_package(git_package)
repo.add_package(get_package("a", "1.2.3"))
solver = Solver(package, pool, installed, locked, io)
ops = solver.solve()
check_solver_result(
ops,
[
{"job": "install", "package": get_package("a", "1.2.3")},
{"job": "install", "package": git_package, "skipped": True},
],
)
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