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

cmany.yml doesn't seem to work #8

Open
TSlivede opened this issue Jun 4, 2020 · 4 comments
Open

cmany.yml doesn't seem to work #8

TSlivede opened this issue Jun 4, 2020 · 4 comments
Labels

Comments

@TSlivede
Copy link

TSlivede commented Jun 4, 2020

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
@biojppm
Copy link
Owner

biojppm commented Jun 4, 2020

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.

@biojppm biojppm changed the title cmany.yml doesen't seem to work cmany.yml doesn't seem to work Jun 4, 2020
@TSlivede
Copy link
Author

TSlivede commented Jun 5, 2020

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.

@TSlivede
Copy link
Author

TSlivede commented Jun 5, 2020

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.

@biojppm biojppm added the bug label Jun 5, 2020
@biojppm
Copy link
Owner

biojppm commented Jun 5, 2020

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.

biojppm added a commit that referenced this issue Jun 6, 2020
biojppm added a commit that referenced this issue Jun 6, 2020
apiviuw added a commit to apiviuw/cmany that referenced this issue Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants