I have a library that uses a python code generator to read in some yaml files and spit out a *.hpp file. Now I want to ship it on conancenter and have it build effortlessly on the consumer machines.
There's one problem though: I use the pyyaml package for the code generator to read the yaml file, which is not guaranteed to be available on consumer system. Heck not even python might be installed! And of course all of that would need to run in a seperate environment to ensure the right pyyaml/python versions.., which might collide with the environment that the user is already using.
Is there a way to ensure python + pyyaml are installed on the fly using build requirements in conan?
I thought about it for a moment, but the problem seems to be that I cannot install python from conancenter (it's simply not available) and hence cannot use it in the build requirements. And I can't use bash since I can't read yaml files without also downloading some additinal tools.
What can I do here?
At the moment there is no built-in to do this in Conan, because it requires not only managing Python as a package, but also creating virtualenvironments on the fly for the tools, and injecting those exclusively on their dependants. There is https://github.com/conan-io/conan/pull/11601 planned for the 2.X roadmap, and the CPython recipe will eventually be 2.0-ready too in ConanCenter.
In any case, Conan itself uses
pyyaml6.0, which should be modern enough, so this specific dependency should already be available, even in the bundled executable distribution.