fixed docstring in utils
This commit is contained in:
parent
3cd0f1a35d
commit
e1332b7d00
1 changed files with 20 additions and 2 deletions
|
|
@ -364,10 +364,28 @@ def virtualenv_source():
|
||||||
@_contextmanager
|
@_contextmanager
|
||||||
def virtualenv():
|
def virtualenv():
|
||||||
"""
|
"""
|
||||||
helper method to set the virtual environment for the following commands
|
Context manager for setting the virtual environment for commands.
|
||||||
|
|
||||||
uses python yield command
|
This helper method sets up the virtual environment specified in the
|
||||||
|
configuration before executing any commands within its context. It uses
|
||||||
|
the Python context manager pattern with the `yield` keyword to
|
||||||
|
temporarily modify the environment for the duration of the with-block.
|
||||||
|
The virtual environment is specified by the name in
|
||||||
|
`configuration.virtualenv.name` and is activated using the `workon`
|
||||||
|
command.
|
||||||
|
|
||||||
|
Note:
|
||||||
|
- This method relies on the Fabric library's `prefix` context manager
|
||||||
|
and assumes the use of virtualenvwrapper or a similar tool for
|
||||||
|
managing virtual environments.
|
||||||
|
- The method expects `configuration.virtualenv.name` to be properly
|
||||||
|
set in `env.config`.
|
||||||
|
|
||||||
|
Example Usage:
|
||||||
|
with virtualenv():
|
||||||
|
run("python manage.py migrate")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
configuration = env.config
|
configuration = env.config
|
||||||
with virtualenv_source():
|
with virtualenv_source():
|
||||||
with prefix("workon %s" % configuration.virtualenv.name):
|
with prefix("workon %s" % configuration.virtualenv.name):
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue