Skip to content

Commit 1eb94e1

Browse files
authored
Added docs for deactivate mode config (#4286)
1 parent 141031f commit 1eb94e1

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

reference/config_files/global_conf.rst

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,3 +308,64 @@ behavior. If ``core.download:parallel=0``, then the behavior will be to not use
308308
download and unzip of precompiled package binaries.
309309
This ``core.download:parallel`` configuration also affects the ``conan download`` command, but for that command
310310
the default at the moment is not to use parallelism, but sequential download.
311+
312+
313+
Environment deactivation functions
314+
++++++++++++++++++++++++++++++++++
315+
316+
.. include:: ../../common/experimental_warning.inc
317+
318+
319+
When setting the configuration ``tools.env:deactivation_mode`` to ``function`` in your profile or in
320+
``global.conf``, the deactivation scripts will no longer be generated.
321+
322+
Instead, an *in-memory* deactivation function will be available in the
323+
current shell session as soon as you activate the conan environment.
324+
325+
Moving from the classical Conan workflow:
326+
327+
.. tabs::
328+
329+
.. code-tab:: bash
330+
331+
$ source conanbuild.sh
332+
$ ...
333+
$ source deactivate_conanbuild.sh
334+
335+
.. code-tab:: powershell
336+
337+
$ .\conanbuild.ps1
338+
$ ...
339+
$ .\deactivate_conanbuild.ps1
340+
341+
To the new workflow,
342+
343+
.. tabs::
344+
345+
.. code-tab:: bash
346+
347+
$ source conanbuild.sh
348+
$ ...
349+
$ deactivate_conanbuild # from anywhere in the shell
350+
351+
.. code-tab:: powershell
352+
353+
$ .\conanbuild.ps1
354+
$ ...
355+
$ deactivate_conanbuild # from anywhere in the shell
356+
357+
By executing this function, the environment will be restored and the function will no longer be
358+
available in the current shell session. This behavior emulates the well known ``virtualenv`` Python tool.
359+
360+
.. attention::
361+
362+
This feature does not currently support Windows Command Prompt (``.bat`` files).
363+
It is only available for PowerShell and Bash-like shells.
364+
365+
366+
.. code-block:: text
367+
:caption: *global.conf*
368+
369+
tools.env:deactivation_mode=function
370+
371+
**Default value:** None.

0 commit comments

Comments
 (0)