lukasberbuer / conan-check-updates

Check for updates of your conanfile.txt/conanfile.py requirements
MIT License
2 stars 2 forks source link

conan-check-update fails if additional arguments are passed to self.requires(...) #3

Closed h4haase closed 2 months ago

h4haase commented 2 months ago

In one of my conan files I have a private requirement, i.e.

def requirements(self):
    self.requires("my_package/1.3.15@myuser/stable", "private")

conan-check-update fails with

Traceback (most recent call last):
File "/home/myuser/.local/bin/conan-check-updates", line 8, in <module>
sys.exit(main())
File "/home/myuser/.local/lib/python3.10/site-packages/conan_check_updates/cli.py", line 186, in wrapper
loop.run_until_complete(func(*args, **kwargs))
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/myuser/.local/lib/python3.10/site-packages/conan_check_updates/cli.py", line 204, in main
results = await check_updates(
File "/home/myuser/.local/lib/python3.10/site-packages/conan_check_updates/main.py", line 69, in check_updates
refs = inspect_requires_conanfile(conanfile)
File "/home/myuser/.local/lib/python3.10/site-packages/conan_check_updates/conan.py", line 262, in inspect_requires_conanfile
return inspect_requires_conanfile_py(conanfile) + inspect_requirements_conanfile_py(
File "/home/myuser/.local/lib/python3.10/site-packages/conan_check_updates/conan.py", line 193, in inspect_requirements_conanfile_py
return list(map(ConanReference.parse, refs))
File "/home/myuser/.local/lib/python3.10/site-packages/conan_check_updates/conan.py", line 141, in parse
raise ValueError(f"Invalid Conan reference '{reference}'")
ValueError: Invalid Conan reference 'my_package/1.3.15@myuser/stable", "private'
lukasberbuer commented 2 months ago

Thanks for pointing this out @h4haase. Show be fixed with #4. Can you verify this?

h4haase commented 2 months ago

Yes this works, thank you. However, the conan file contains another reference to "yaml-cpp/0.7.0@" which seems to be valid and work fine with conan, but conan-check-update shows an error very similar to the original one:

raise ValueError(f"Invalid Conan reference '{reference}'") ValueError: Invalid Conan reference 'yaml-cpp/0.7.0@'

Removing the "@" does not show the error.

lukasberbuer commented 2 months ago

I see. Conan isn't too clear about how the schema of a reference should look like: https://docs.conan.io/2/reference/conanfile/attributes.html#package-reference

I guess, I seems that we are more strict than Conan here... What is the reason to just append a @ without providing a user?

h4haase commented 2 months ago

There is no particular reason, it probably was just cut‘n pasted from somewhere. The package does not have a user and channel. When searching with Conan v1 (i.e. conan search …) the @ makes a difference. Without the @ it will search for packages with corresponding name/version, with the @ it will list the properties of this particular package. AFAIR, also installing by hand , i.e. conan install yaml-cpp/0.7.0@ requires the @ to be there.