conan-io / docs

conan.io reStructuredText documentation
http://docs.conan.io
MIT License
104 stars 352 forks source link

Document `tool_requires(..., options={})` and other methods of setting build requirement options #3026

Open samuel-emrys opened 1 year ago

samuel-emrys commented 1 year ago

The 2.0 documentation doesn't address any methods of setting the options of build requirements, either tool_requires or test_requires. The 1.x method of setting them in configure() doesn't appear to be working in 2.0 (not sure if this is a bug), but the documentation should address at least some methods of doing this.

The following links refer to the tool_requires(..., options={}) syntax which is currently undocumented as far as I can tell:

I had a feeling that I'd seen another method of setting options for build requirements, but I can't find the issue at the moment. It strikes me that there must be one, because as it stands the above syntax is not sufficient to modify package options based on logic.

For completeness, this appears to work:

def build_requirements(self):
    self.tool_requires("mytool@user/channel",options={"optA":"value"})
uyha commented 1 year ago

tool_requires and test_requires are documented here but they all refer to requires which is undocumented for now AFAIK.

samuel-emrys commented 1 year ago

@uyha yes, thanks - I found those in the documentation. This ticket is not about documenting tool_requires generally, but about documenting ways of setting options on tool_requires packages from consuming recipes since the 1.x method of using configure() no longer seems to work:

def build_requirements(self):
    self.tool_requires("mytool/version@user/channel")

def configure(self):
    self.options["mytool"].optA = "value"
roalter commented 1 year ago

Would be great if somehow this would still be possible in 1.x. Still strugling on updating to 2.x.