Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs for new powershell conf #3947

Merged
merged 3 commits into from
Dec 18, 2024
Merged
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
13 changes: 11 additions & 2 deletions reference/tools/env/envvars.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,17 @@ method.

It will generate automatically a ``my_env_file.bat`` for Windows systems or ``my_env_file.sh`` otherwise.

It's possible to opt-in to generate Powershell ``.ps1`` scripts instead of ``.bat`` ones, using the
conf ``tools.env.virtualenv:powershell=True``.
It is possible to opt-in to generate PowerShell ``.ps1`` scripts instead of ``.bat`` ones,
by using the configuration ``tools.env.virtualenv:powershell``. This configuration should
be set with the value corresponding to the desired PowerShell executable:
``powershell.exe`` for versions up to 5.1, and ``pwsh`` for PowerShell versions starting
from 7. Note that setting ``tools.env.virtualenv:powershell`` to ``True`` or ``False`` is
deprecated as of Conan 2.11.0.
czoido marked this conversation as resolved.
Show resolved Hide resolved

You can also include additional arguments in the ``tools.env.virtualenv:powershell``
configuration. For example, you can set the value to ``powershell.exe -NoProfile`` or
``pwsh -NoProfile`` by including the arguments as part of the configuration value. These
arguments will be considered when executing the generated ``.ps1`` launchers.

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
Expand Down
6 changes: 5 additions & 1 deletion reference/tools/env/virtualbuildenv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ will create the following files:

.. note::

To create ``.ps1`` files required for Powershell it is necessary to set to True the following conf: ``tools.env.virtualenv:powershell``.
To create ``.ps1`` files required for PowerShell, you need to set the
``tools.env.virtualenv:powershell`` configuration with the value of the PowerShell
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::

Expand Down
5 changes: 4 additions & 1 deletion reference/tools/env/virtualrunenv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ current active configuration, like ``deactivate_conanrunenv-release-x86_64.bat``

.. note::

To create ``.ps1`` files required for Powershell it is necessary to set to True the following conf: ``tools.env.virtualenv:powershell``.
To create ``.ps1`` files required for PowerShell, you need to set the
``tools.env.virtualenv:powershell`` configuration with the value of the PowerShell
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::

Expand Down
11 changes: 8 additions & 3 deletions tutorial/consuming_packages/use_tools_as_conan_packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,14 @@ files the folder *build*. To do that, just run:

.. note::

**Powershell** users need to add ``--conf=tools.env.virtualenv:powershell=True`` to the previous command
to generate ``.ps1`` files instead of ``.bat`` files.
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>`.
**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
:ref:`profiles section<reference_config_files_profiles>`.

You can check the output:

Expand Down