We have a hook that uses some feature that was introduced with Conan 2.16:
extensions/hooks/hook_sbom.py:
from conan.tools.sbom.cyclonedx import cyclonedx_1_6 # Only availabe with Conan >= 2.16.
# More code would follow here, of course.
We have the following in our global.conf to tell people they need to update the version:
core:required_conan_version= >=2.16
However when doing a simple test with Conan 2.15, we get the following error:
$ conan list
Error in Conan initialization: Error loading hook '/tmp/conan/conan-home/extensions/hooks/hook_sbom.py': Unable to load conanfile in /tmp/conan/conan-home/extensions/hooks/hook_sbom.py
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/tmp/conan/conan-home/extensions/hooks/hook_sbom.py", line 1, in <module>
from conan.tools.sbom.cyclonedx import cyclonedx_1_6
ImportError: cannot import name 'cyclonedx_1_6' from 'conan.tools.sbom.cyclonedx' (/tmp/conan/venv/lib/python3.11/site-packages/conan/tools/sbom/cyclonedx.py)
This is not expected.
The expected behaviour would be:
$ conan list
Error in Conan initialization: Current Conan version (2.15.0) does not satisfy the defined one (>=2.16).
Additionally, I find it unexpected that commands that are completely independent from the Conan Home and Cache also report failure, especially such simple and trivial commands like these:
$ conan --version
Error in Conan initialization: Current Conan version (2.15.0) does not satisfy the defined one (>=2.16).
$ conan --help
Error in Conan initialization: Current Conan version (2.15.0) does not satisfy the defined one (>=2.16).
Environment: Conan 2.15.0 (for the real-world example above, I verified with 2.18.1, too. Bug is still there.)
We have a hook that uses some feature that was introduced with Conan 2.16:
extensions/hooks/hook_sbom.py:We have the following in our
global.confto tell people they need to update the version:However when doing a simple test with Conan 2.15, we get the following error:
This is not expected.
The expected behaviour would be:
Additionally, I find it unexpected that commands that are completely independent from the Conan Home and Cache also report failure, especially such simple and trivial commands like these:
Environment: Conan 2.15.0 (for the real-world example above, I verified with
2.18.1, too. Bug is still there.)