diff --git a/reference/tools/env/envvars.rst b/reference/tools/env/envvars.rst index 0019604bf01b..b776b6453f1b 100644 --- a/reference/tools/env/envvars.rst +++ b/reference/tools/env/envvars.rst @@ -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. @@ -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 ++++++++++++++++++++++++++++++++++ diff --git a/reference/tools/env/virtualbuildenv.rst b/reference/tools/env/virtualbuildenv.rst index 6a480123b6ba..720fbecc18a6 100644 --- a/reference/tools/env/virtualbuildenv.rst +++ b/reference/tools/env/virtualbuildenv.rst @@ -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. diff --git a/reference/tools/env/virtualrunenv.rst b/reference/tools/env/virtualrunenv.rst index c3f5d0155951..b5d17e8c0c6a 100644 --- a/reference/tools/env/virtualrunenv.rst +++ b/reference/tools/env/virtualrunenv.rst @@ -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. diff --git a/tutorial/consuming_packages/use_tools_as_conan_packages.rst b/tutorial/consuming_packages/use_tools_as_conan_packages.rst index b08941e63a4b..40b3a31d95e5 100644 --- a/tutorial/consuming_packages/use_tools_as_conan_packages.rst +++ b/tutorial/consuming_packages/use_tools_as_conan_packages.rst @@ -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=`` - (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=`` + (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`. + **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