CastXML / pygccxml

pygccxml is a specialized XML reader that reads the output from CastXML or GCCXML. It provides a simple framework to navigate C++ declarations, using Python classes.
Boost Software License 1.0
129 stars 44 forks source link

packaging pygccxml for nixos #94

Closed teto closed 5 years ago

teto commented 6 years ago

hi,

I am trying to package pygccxml for nixos as can be seen here: https://github.com/NixOS/nixpkgs/pull/30473#issuecomment-342442515

When running the tests, they can't find stddef.h/stdarg.h even when I export the path to the correct folder: export CFLAGS="-I${llvmPackages.clang-unwrapped.out}/lib/clang/4.0.1/include" python3 -m unittests.test_all

Should I do sthg peculiar to run the tests ? I noticed the "unittests/xml_generator.cfg: file that I may have to fill ? Nixos paths are a bit peculiar for instance castxml is installed in /nix/store/a4j1cmb78sac7wzzg6v0dq6wlzd3jrjd-CastXML-20171003/bin/castxml so that may the reason why.

EDIT: I see travis does move the config to xml_generator.cfg, I'll look into it

teto commented 6 years ago

seems like the tests dont take into account CFLAGS ?

Nixos gives me the include path under this form -isystem $(echo -n /nix/store/mdzzvpnxzbwd6s1nchpjnr3vpqybf6v0-gcc-6.4.0/include/c++/*) -isystem $(echo -n /nix/store/mdzzvpnxzbwd6s1nchpjnr3vpqybf6v0-gcc-6.4.0/include/c++/*)/$(/nix/store/mdzzvpnxzbwd6s1nchpjnr3vpqybf6v0-gcc-6.4.0/bin/gcc -dumpmachine) Do I have to convert it to a format accepted by include_paths= or is there another way ?

iMichka commented 6 years ago

Hi. Yes I think that you need to pass everything through include_paths. Please note that the tests were never written with the idea in mind to run it somewhere else than in Travis or on my local computer.

As a package manager myself (for Homebrew/Linuxbrew), I think it is up to upstream to keep the tests running. Not sure why the package manager should care about running the test suite. A small test may be sufficient. But you may have a different strategy for nixos so it’s your call :)

If you have more questions I can have a look at the include paths when I am back home.

teto commented 6 years ago

As a package manager myself (for Homebrew/Linuxbrew), I think it is up to upstream to keep the tests running

That's also my opinion but I can understand those who would like to run tests in their environments since they all differ. This is especially true in the nixos case which is very different than other distribs, having the tests helps detect behaviors and also can show users how to setup the program.

rather than having include_paths, it might be more generic to have a "commandline" settings so that I can pass the -isystem PATH directly.

teto commented 5 years ago

it got packaged in nixos. Closing