You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It contains two conanfiles, a base conan file, which contains a base for conan file and custom extension of conans.CMake class, which allows some customizations of the CMake helper (better described in issue #3099), and normal conanfile that python_requires the base.
With Conan 1.25.2, this works as expected:
cd base
conan export ./conanfile.py user/testing
cd ..
conan create ./conanfile user/testing
With conan 1.26.0 the first conan export yields following error:
ERROR: Error loading conanfile at '/Users/dodo/Desktop/conan-issue/base/conanfile.py': Unable to load conanfile in /Users/dodo/Desktop/conan-issue/base/conanfile.py
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/imp.py", line 171, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/dodo/Desktop/conan-issue/base/conanfile.py", line 5, in <module>
class CMake(conans.CMake):
TypeError: function() argument 1 must be code, not str
Even if I export the base with conan 1.25.2 and then attempt to use derived with conan 1.26.0 I still get a crash:
ERROR: Error loading conanfile at '/Users/dodo/Desktop/conan-issue/conanfile.py': Error loading conanfile at '/Users/dodo/.conan/data/base/1.0.0/user/testing/export/conanfile.py': Unable to load conanfile in /Users/dodo/.conan/data/base/1.0.0/user/testing/export/conanfile.py
KeyError: base/1.0.0@user/testing
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/conans/client/loader.py", line 352, in _parse_conanfile
loaded = imp.load_source(module_id, conan_file_path)
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/imp.py", line 171, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/dodo/.conan/data/base/1.0.0/user/testing/export/conanfile.py", line 5, in <module>
class CMake(conans.CMake):
TypeError: function() argument 1 must be code, not str
The text was updated successfully, but these errors were encountered:
This is not because of python_requires, but because of inheriting from conans.CMake, as we changed the interface for the new "toolchain" feature. Proposing a new name in #7198 to avoid the issue, though we might want to consider other alternatives, as metaclasses.
# In 1.26.0, conans.CMake became a factory so we need to pick the class it returns
try:
from conans.client.build.cmake import CMakeBuildHelper as CMake
except ImportError:
from conans import CMake
Thanks for the hint @rddesmond
Don't hesitate to report these issues before implementing workarounds, when new versions introduce regressions, we are willing to revert them and provide other alternatives, but we need to know that we are breaking :)
Thanks, @memsharded, great work on conan! s@DoDoENT beat me to writing the story (I swear I'm not shy -- I added a different one on Friday), and I found the workaround I posted while triaging.
Consider this example: conan-issue.zip
It contains two conanfiles, a base conan file, which contains a base for conan file and custom extension of
conans.CMake
class, which allows some customizations of the CMake helper (better described in issue #3099), and normal conanfile thatpython_requires
the base.With Conan 1.25.2, this works as expected:
With conan 1.26.0 the first
conan export
yields following error:Even if I export the base with conan 1.25.2 and then attempt to use derived with conan 1.26.0 I still get a crash:
The text was updated successfully, but these errors were encountered: