File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ generator_info
102102.. include:: ../../common/experimental_warning.inc
103103
104104Generators to be passed to the dependant recipes.
105- Should be only filled in the ``package_info()`` method.
105+ Should be only filled in the ``package_info()`` method, ``None`` by default .
106106
107107.. seealso::
108108
Original file line number Diff line number Diff line change @@ -306,7 +306,7 @@ generator_info
306306
307307
308308`` tool_requires`` in the build context can inject generators into the recipe,
309- by adding them to the `` generator_info`` list inside the `` package_info`` method.
309+ by adding them to the `` generator_info`` attribute inside the `` package_info`` method.
310310This is useful to inject custom generators into the recipe, that will be used by the consumers of the package,
311311just as if they were declared in their `` generators`` attribute.
312312
@@ -320,9 +320,10 @@ just as if they were declared in their ``generators`` attribute.
320320 self .output.info(f " Calling custom generator for { conanfile} " )
321321
322322 def package_info(self ):
323- self .generator_info.append( MyGenerator)
323+ self .generator_info = [ MyGenerator]
324324
325- Note that this only propagates from the immediate, direct `` tool_requires`` of a recipe.
325+ Note that this only propagates from the immediate, direct `` tool_requires`` of a recipe,
326+ and that by default `` self .generator_info`` is `` None `` .
326327
327328
328329.. note::
Original file line number Diff line number Diff line change @@ -110,7 +110,8 @@ Generators from tool_requires
110110A direct dependency tool requires can also be used to provide custom generators.
111111The following example shows how to create a custom generator that generates a file with the
112112dependencies of the package, just like the example above, but using a ``tool_require `` instead of a ``python_require ``
113- to inject the generator into the recipe, by adding them to the ``self.generator_info `` list inside the ``package_info `` method.
113+ to inject the generator into the recipe, by adding them to the ``self.generator_info `` attribute inside the ``package_info `` method.
114+ Note that this attribute is ``None `` by default, so you need to set it explicitly to a list of generators.
114115
115116.. code-block :: python
116117 :caption: mygenerator/ conanfile.py
@@ -141,6 +142,6 @@ inject the generator into the recipe.
141142.. note ::
142143
143144 Note that built-in generators can also be injected using tool_requires,
144- by adding them by name: ``self.generator_info.append( "CMakeDeps") ``.
145+ by adding them by name: ``self.generator_info = [ "CMakeDeps"] ``.
145146 ``tool_require ``'ing this package will inject the ``CMakeDeps `` generator into the recipe
146147 just as if it was declared in its ``generators `` attribute.
You can’t perform that action at this time.
0 commit comments