Skip to content

Commit

Permalink
allow template placeholder in EnvVars (conan-io#2835)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded authored Nov 30, 2022
1 parent 2171e24 commit 9a696bc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions reference/conanfile/tools/env/envvars.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,21 @@ You can iterate the environment variables of an ``EnvVars`` object like this:
assert value == "var var2"
The current value of the environment variable in the system is replaced in the returned value. This happens
when variables are appended or prepended. If a placeholder is desired instead of the actual value, it is
possible to use the ``variable_reference`` argument with a jinja template syntax, so a string with that
resolved template will be returned instead:

.. code:: python
env1 = Environment()
env1.append("foo", "var")
envvars = env1.vars(self)
for name, value in envvars.items(variable_reference="$penv{{{name}}}""):
assert name == "foo":
assert value == "$penv{{foo}} var"
.. warning::
In Windows, there is a limit to the size of environment variables, a total of 32K for the whole environment,
Expand Down

0 comments on commit 9a696bc

Please sign in to comment.