8000 Actually we need to use a function, an alias does not allow for prope… · matplotlib/matplotlib@22849c3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 22849c3

Browse files
committed
Actually we need to use a function, an alias does not allow for proper conditionals
1 parent fae3bca commit 22849c3

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

doc/faq/virtualenv_faq.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,22 @@ framework build within the virtualenv. To run a script you can do
113113
framework build. To run an interactive ``IPython`` session with the framework
114114
build within the virtual environment you can do ``frameworkpython -m IPython``
115115

116-
``PYTHONHOME`` Alias
117-
--------------------
116+
``PYTHONHOME`` Function
117+
-----------------------
118118

119-
Alternatively you can define an alias in your ``.bashrc`` using
119+
Alternatively you can define a function in your ``.bashrc`` using
120120

121121
.. code:: bash
122122
123-
alias frameworkpython='[[ ! -z "$VIRTUAL_ENV" ]] && PYTHONHOME=$VIRTUAL_ENV /usr/local/bin/python || /usr/local/bin/python'
123+
function frameworkpython {
124+
if [[ ! -z "$VIRTUAL_ENV" ]]; then
125+
PYTHONHOME=$VIRTUAL_ENV /usr/local/bin/python "$@"
126+
else
127+
/usr/local/bin/python "$@"
128+
fi
129+
}
124130
125-
This alias can then be used in all of your virtualenvs without having to
131+
This function can then be used in all of your virtualenvs without having to
126132
fix every single one of them.
127133

128134
PythonW Compiler

0 commit comments

Comments
 (0)
0