cmany
cmany copied to clipboard
cmany.yml doesn't seem to work
If I use cmany without a cmany.yml file, it seems to work fine. create_proj
also seems to work. However any commands after that, that try to read the cmany.yml
file, seem to crash:
PS C:\path\to\my\project> cmany create_proj
PS C:\path\to\my\project> cmany show_build_names
Traceback (most recent call last):
File "C:\Program Files\Python38\Scripts\cmany-script.py", line 11, in <module>
load_entry_point('cmany', 'console_scripts', 'cmany')()
File "C:\Program Files\Python38\__manually_downloaded_via_git\cmany\src\c4\cmany\main.py", line 52, in cmany_main
args.func(args)
File "C:\Program Files\Python38\__manually_downloaded_via_git\cmany\src\c4\cmany\args.py", line 47, in exec_cmd
proj = obj.proj(args)
File "C:\Program Files\Python38\__manually_downloaded_via_git\cmany\src\c4\cmany\main.py", line 137, in proj
return Project(**vars(args))
File "C:\Program Files\Python38\__manually_downloaded_via_git\cmany\src\c4\cmany\project.py", line 101, in __init__
self._init_with_build_items(**kwargs)
File "C:\Program Files\Python38\__manually_downloaded_via_git\cmany\src\c4\cmany\project.py", line 126, in _init_with_build_items
self.add_build(s_, a_, c_, t_, v_)
File "C:\Program Files\Python38\__manually_downloaded_via_git\cmany\src\c4\cmany\project.py", line 227, in add_build
s = _dup_item(system)
File "C:\Program Files\Python38\__manually_downloaded_via_git\cmany\src\c4\cmany\project.py", line 225, in _dup_item
i.flags.resolve_flag_aliases(compiler, aliases=self.configs.flag_aliases)
File "C:\Program Files\Python38\__manually_downloaded_via_git\cmany\src\c4\cmany\build_flags.py", line 36, in resolve_flag_aliases
self.defines = aliases.as_defines(self.defines, compiler)
AttributeError: 'NoneType' object has no attribute 'as_defines'
PS C:\path\to\my\project>
Content of cmany.yml
:
project:
systems:
- windows
architectures:
- x86_64
compilers:
- vs2019
build_types:
- Release
variants:
- none
Caveat emptor: at the current time, cmany.yml is just a torso and is very experimental; this is explicit in the documentation. You should not use it for anything other than providing flag aliases.
By the way, from the error message it seems to be exactly what you are missing there: here's the main cfg file.
I've stalled work on this feature as I'm not sure how to integrate it with the command line approach, which (verbose as it is) remains for now the main focus, and I just did not have time to think this through and follow up on that with a working implementation. I hope to have the opportunity to revisit this, but for now it's just not on the horizon.
Even with the linked file, the same exception is raised.
The problem seems to be on line 98 in conf.py
:
self.flag_aliases = self.flag_aliases.merge_from(other.flag_aliases)
self.flag_aliases
is overwritten with result of self.flag_aliases.merge_from(.....)
. However that method doesn't actually return anything, instead it modifies it's self object. Line 37...39 of flags.py
:
def merge_from(self, other):
self.flags = merge(self.flags, other.flags)
self.compilers = get_all_compilers(self.flags)
If I change line 98 in conf.py
to
self.flag_aliases.merge_from(other.flag_aliases)
the exception is no longer thrown.
Though as you said, the project settings in cmany.yml still seem to be ignored...
As that's the case: Could you mention in the output of cmany --help that the create_proj
does not yet work / is still experimental.
Thanks for the investigation, it does help.
You're right, create_proj
should not be there, together with some other experimental features that for now are best left out.