Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix python_requires in transitive deps with version ranges #13762

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions conans/client/graph/python_requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def _resolve_ref(self, requirement, graph_lock, remotes, update):
"Please use version ranges instead")
if graph_lock:
graph_lock.resolve_locked_pyrequires(requirement)
else:
self._range_resolver.resolve(requirement, "py_require", remotes, update)
# If the lock hasn't resolved the range, and it hasn't failed (it is partial), resolve it
self._range_resolver.resolve(requirement, "py_require", remotes, update)
ref = requirement.ref
return ref

Expand Down
17 changes: 17 additions & 0 deletions conans/test/integration/py_requires/python_requires_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1164,3 +1164,20 @@ def test_multi_top_missing_from_remote():
assert "dep/1.0@user/testing: Downloaded recipe revision" in tc.out
assert "base/1.1@user/testing: Not found in local cache, looking in remotes..." in tc.out
assert "base/1.1@user/testing: Downloaded recipe revision" in tc.out


def test_transitive_range_not_found_in_cache():
"""
https://github.com/conan-io/conan/issues/13761
"""
c = TestClient()
c.save({"conanfile.py": GenConanfile("pr", "1.0")})
c.run("create .")

c.save({"conanfile.py": GenConanfile("dep", "1.0").with_python_requires("pr/[>0]")})
c.run("create .")

c.save({"conanfile.py": GenConanfile("pkg", "1.0").with_requires("dep/1.0")})
c.run("create . ")
c.assert_listed_require({"pr/1.0": "Cache"}, python=True)
assert "pr/[>0]: pr/1.0" in c.out