Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions reference/tools/env/envvars.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,23 @@ configuration. For example, you can set the value to ``powershell.exe -NoProfile
``pwsh -NoProfile`` by including the arguments as part of the configuration value. These
arguments will be considered when executing the generated ``.ps1`` launchers.

On Linux and macOS, it is also possible to (new in Conan 2.32) **additionally** generate Fish
shell ``.fish`` launchers, on top of (never instead of) the ``.sh`` one, by setting the
``tools.env.virtualenv:fish`` configuration to ``True``. Unlike
``tools.env.virtualenv:powershell``, this configuration is a plain boolean:

.. code-block:: text
:caption: *global.conf*

tools.env.virtualenv:fish=True

Fish launchers are only meant to be manually ``source``-d by the final consumer in their own
interactive Fish session. Conan itself never uses them to wrap ``self.run()`` commands, not even
when explicitly requested (see below), since Fish is not sh/cmd-syntax compatible: the ``.sh``
(or ``.bat``) launcher is always used for that instead. Because of that, Fish launchers also
always expose their deactivation as a ``deactivate_xxx`` Fish function, regardless of the
``tools.env:deactivation_mode`` configuration.

Also, by default, Conan will automatically append that launcher file path to a list that will be used to
create a ``conanbuild.bat|sh|ps1`` file aggregating all the launchers in order. The ``conanbuild.sh|bat|ps1`` launcher
will be created after the execution of the ``generate()`` method.
Expand Down Expand Up @@ -92,6 +109,13 @@ You can change the default launcher with the ``env`` argument of ``self.run()``:
# powershell my_env_file.ps1 ; cmd c/ foo
self.run("foo", env=["my_env_file"])

.. note::

A ``.fish`` launcher, if generated, is never used here, even when passed explicitly via
``env=["my_env_file.fish"]``: Conan always wraps ``self.run()`` with the ``.sh``/``.bat``
launcher instead. Fish launchers are for a final consumer to ``source`` by hand in their own
shell, not for Conan to use internally.


Applying the environment variables
++++++++++++++++++++++++++++++++++
Expand Down
8 changes: 8 additions & 0 deletions reference/tools/env/virtualbuildenv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ will create the following files:
or ``False`` is deprecated as of Conan 2.11.0 and should no longer be used.


.. note::

On Linux and macOS, setting the (new in Conan 2.32) ``tools.env.virtualenv:fish`` configuration
to ``True`` will **additionally** create ``.fish`` launchers, on top of (never instead of) the
``.sh`` ones. These are only meant to be manually ``source``-d by the final consumer in an
interactive Fish session: Conan itself never uses them to wrap ``self.run()`` commands.


.. note::

To create ``.env`` dotenv files, use the **experimental** (new in Conan 2.21) ``tools.env:dotenv`` configuration.
Expand Down
7 changes: 7 additions & 0 deletions reference/tools/env/virtualrunenv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ current active configuration, like ``deactivate_conanrunenv-release-x86_64.bat``
executable (e.g., ``powershell.exe`` or ``pwsh``). Note that, setting it to ``True``
or ``False`` is deprecated as of Conan 2.11.0 and should no longer be used.

.. note::

On Linux and macOS, setting the (new in Conan 2.32) ``tools.env.virtualenv:fish`` configuration
to ``True`` will **additionally** create ``.fish`` launchers, on top of (never instead of) the
``.sh`` ones. These are only meant to be manually ``source``-d by the final consumer in an
interactive Fish session: Conan itself never uses them to wrap ``self.run()`` commands.

.. note::

To create ``.env`` dotenv files, use the **experimental** (new in Conan 2.21) ``tools.env:dotenv`` configuration.
Expand Down
17 changes: 11 additions & 6 deletions tutorial/consuming_packages/use_tools_as_conan_packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,20 @@ files in the folder *build*. To do that, just run:

.. note::

**PowerShell** users need to add ``--conf=tools.env.virtualenv:powershell=<executable>``
(e.g., ``powershell.exe`` or ``pwsh``) to the previous command to generate ``.ps1`` files
instead of ``.bat`` files. Setting this configuration to ``True`` or ``False`` is deprecated
as of Conan 2.11.0.
**PowerShell** users need to add ``--conf=tools.env.virtualenv:powershell=<executable>``
(e.g., ``powershell.exe`` or ``pwsh``) to the previous command to generate ``.ps1`` files
instead of ``.bat`` files. Setting this configuration to ``True`` or ``False`` is deprecated
as of Conan 2.11.0.

To avoid the need to add this line every time, we recommend configuring it in the ``[conf]``
section of your profile. For detailed information, please refer to the
To avoid the need to add this line every time, we recommend configuring it in the ``[conf]``
section of your profile. For detailed information, please refer to the
:ref:`profiles section<reference_config_files_profiles>`.

**Fish** shell users on Linux or macOS can add ``--conf=tools.env.virtualenv:fish=True`` to
additionally generate a ``.fish`` launcher alongside the ``.sh`` one (new in Conan 2.32).
It is meant to be sourced by hand in an interactive Fish session; Conan will still use the
``.sh`` launcher internally, e.g. for the ``self.run()`` calls in recipes.

You can check the output:

.. code-block:: bash
Expand Down