File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
reference/conanfile/attributes Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -430,3 +430,24 @@ The 4 different attributes are:
430430.. seealso::
431431
432432 Read the : ref:`binary model reference< reference_binary_model> ` for a full view of the Conan binary model.
433+
434+
435+ context
436+ -------
437+
438+ .. include :: ../ ../ common/ experimental_warning.inc
439+
440+
441+ The ``conanfile.py`` recipe attribute ``context`` will contain either the " build" or " host" value to represent the context where
442+ the current package instance is being evaluated. Recall that it is possible that some recipes might exist both in the " build" and " host"
443+ contexts, depending on the usage.
444+
445+ This attribute shouldn' t be necessary for the vast majority of cases, so it is recommended to avoid using it.
446+ One potential exception for this recommendation would be to break otherwise infinite dependency cycles, defining
447+ some conditional dependency as:
448+
449+ .. code-block:: python
450+
451+ def requirements(self):
452+ if self.context == "host":
453+ self.tool_requires("mytool/1.0")
You can’t perform that action at this time.
0 commit comments