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 version range python_require update #5265

Closed
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
2 changes: 1 addition & 1 deletion conans/client/graph/python_requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _look_for_require(self, require):
except KeyError:
ref = ConanFileReference.loads(require)
requirement = Requirement(ref)
self._range_resolver.resolve(requirement, "python_require", update=False,
self._range_resolver.resolve(requirement, "python_require", update=self._update,
remotes=self._remotes)
ref = requirement.ref
result = self._proxy.get_recipe(ref, self._check_updates, self._update,
Expand Down
34 changes: 34 additions & 0 deletions conans/test/functional/python_requires/python_requires_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,40 @@ def configure(self):
client2.run("install . --update")
self.assertIn("conanfile.py: PYTHON REQUIRE VAR 143", client2.out)

def update_ranges_test(self):
# https://github.com/conan-io/conan/issues/4650#issuecomment-497464305
client = TestClient(servers={"default": TestServer()},
users={"default": [("lasote", "mypass")]})
conanfile = """from conans import ConanFile
somevar = 42
class MyConanfileBase(ConanFile):
pass
"""
client.save({"conanfile.py": conanfile})
client.run("export . MyConanfileBase/1.1@lasote/testing")
client.run("upload * --confirm")

client2 = TestClient(servers=client.servers, users={"default": [("lasote", "mypass")]})

reuse = """from conans import python_requires
base = python_requires("MyConanfileBase/[>1.0]@lasote/testing")
class PkgTest(base.MyConanfileBase):
def configure(self):
self.output.info("PYTHON REQUIRE VAR %s" % base.somevar)
"""

client2.save({"conanfile.py": reuse})
client2.run("install .")
self.assertIn("conanfile.py: PYTHON REQUIRE VAR 42", client2.out)

client.save({"conanfile.py": conanfile.replace("42", "143")})
# Make sure to bump the version!
client.run("export . MyConanfileBase/1.2@lasote/testing")
client.run("upload * --confirm")

client2.run("install . --update")
self.assertIn("conanfile.py: PYTHON REQUIRE VAR 143", client2.out)

def duplicate_pyreq_test(self):
t = TestClient()
conanfile = textwrap.dedent("""
Expand Down