Skip to content

Commit b987b03

Browse files
committed
update docs with examples
1 parent c017813 commit b987b03

File tree

2 files changed

+133
-15
lines changed

2 files changed

+133
-15
lines changed

docs/source/command_ref.rst

Lines changed: 130 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ Syntax::
2525
All command line options are passed directly to ``virtualenv``. The
2626
new environment is automatically activated after being initialized.
2727

28+
::
29+
30+
$ workon
31+
$ mkvirtualenv mynewenv
32+
New python executable in mynewenv/bin/python
33+
Installing distribute.............................................
34+
..................................................................
35+
..................................................................
36+
done.
37+
(mynewenv)$ workon
38+
mynewenv
39+
(mynewenv)$
40+
2841
.. seealso::
2942

3043
* :ref:`scripts-premkvirtualenv`
@@ -39,6 +52,16 @@ Syntax::
3952

4053
rmvirtualenv ENVNAME
4154

55+
You must use :ref:`command-deactivate` before removing the current
56+
environment.
57+
58+
::
59+
60+
(mynewenv)$ deactivate
61+
$ rmvirtualenv mynewenv
62+
$ workon
63+
$
64+
4265
.. seealso::
4366

4467
* :ref:`scripts-prermvirtualenv`
@@ -60,6 +83,28 @@ Syntax::
6083
The environment created by the copy operation is made `relocatable
6184
<http://virtualenv.openplans.org/#making-environments-relocatable>`__.
6285

86+
::
87+
88+
$ workon
89+
$ mkvirtualenv source
90+
New python executable in source/bin/python
91+
Installing distribute.............................................
92+
..................................................................
93+
..................................................................
94+
done.
95+
(source)$ cpvirtualenv source dest
96+
Making script /Users/dhellmann/Devel/virtualenvwrapper/tmp/dest/bin/easy_install relative
97+
Making script /Users/dhellmann/Devel/virtualenvwrapper/tmp/dest/bin/easy_install-2.6 relative
98+
Making script /Users/dhellmann/Devel/virtualenvwrapper/tmp/dest/bin/pip relative
99+
Script /Users/dhellmann/Devel/virtualenvwrapper/tmp/dest/bin/postactivate cannot be made relative (it's not a normal script that starts with #!/Users/dhellmann/Devel/virtualenvwrapper/tmp/dest/bin/python)
100+
Script /Users/dhellmann/Devel/virtualenvwrapper/tmp/dest/bin/postdeactivate cannot be made relative (it's not a normal script that starts with #!/Users/dhellmann/Devel/virtualenvwrapper/tmp/dest/bin/python)
101+
Script /Users/dhellmann/Devel/virtualenvwrapper/tmp/dest/bin/preactivate cannot be made relative (it's not a normal script that starts with #!/Users/dhellmann/Devel/virtualenvwrapper/tmp/dest/bin/python)
102+
Script /Users/dhellmann/Devel/virtualenvwrapper/tmp/dest/bin/predeactivate cannot be made relative (it's not a normal script that starts with #!/Users/dhellmann/Devel/virtualenvwrapper/tmp/dest/bin/python)
103+
(dest)$ workon
104+
dest
105+
source
106+
(dest)$
107+
63108
.. seealso::
64109

65110
* :ref:`scripts-precpvirtualenv`
@@ -83,13 +128,42 @@ Syntax::
83128
If no ``environment_name`` is given the list of available environments
84129
is printed to stdout.
85130

131+
::
132+
133+
$ workon
134+
$ mkvirtualenv env1
135+
New python executable in env1/bin/python
136+
Installing distribute.............................................
137+
..................................................................
138+
..................................................................
139+
done.
140+
(env1)$ mkvirtualenv env2
141+
New python executable in env2/bin/python
142+
Installing distribute.............................................
143+
..................................................................
144+
..................................................................
145+
done.
146+
(env2)$ workon
147+
env1
148+
env2
149+
(env2)$ workon env1
150+
(env1)$ echo $VIRTUAL_ENV
151+
/Users/dhellmann/Devel/virtualenvwrapper/tmp/env1
152+
(env1)$ workon env2
153+
(env2)$ echo $VIRTUAL_ENV
154+
/Users/dhellmann/Devel/virtualenvwrapper/tmp/env2
155+
(env2)$
156+
157+
86158
.. seealso::
87159

88160
* :ref:`scripts-predeactivate`
89161
* :ref:`scripts-postdeactivate`
90162
* :ref:`scripts-preactivate`
91163
* :ref:`scripts-postactivate`
92164

165+
.. _command-deactivate:
166+
93167
deactivate
94168
----------
95169

@@ -105,6 +179,24 @@ Syntax::
105179
This command is actually part of virtualenv, but is wrapped to
106180
provide before and after hooks, just as workon does for activate.
107181

182+
::
183+
184+
$ workon
185+
$ echo $VIRTUAL_ENV
186+
187+
$ mkvirtualenv env1
188+
New python executable in env1/bin/python
189+
Installing distribute.............................................
190+
..................................................................
191+
..................................................................
192+
done.
193+
(env1)$ echo $VIRTUAL_ENV
194+
/Users/dhellmann/Devel/virtualenvwrapper/tmp/env1
195+
(env1)$ deactivate
196+
$ echo $VIRTUAL_ENV
197+
198+
$
199+
108200
.. seealso::
109201

110202
* :ref:`scripts-predeactivate`
@@ -133,15 +225,20 @@ subdirectory.
133225

134226
::
135227

136-
$ workon pymotw
137-
$ echo $VIRTUAL_ENV
138-
/Users/dhellmann/.virtualenvs/pymotw
139-
$ cdvirtualenv
140-
$ pwd
141-
/Users/dhellmann/.virtualenvs/pymotw
142-
$ cdvirtualenv bin
143-
$ pwd
144-
/Users/dhellmann/.virtualenvs/pymotw/bin
228+
$ mkvirtualenv env1
229+
New python executable in env1/bin/python
230+
Installing distribute.............................................
231+
..................................................................
232+
..................................................................
233+
done.
234+
(env1)$ echo $VIRTUAL_ENV
235+
/Users/dhellmann/Devel/virtualenvwrapper/tmp/env1
236+
(env1)$ cdvirtualenv
237+
(env1)$ pwd
238+
/Users/dhellmann/Devel/virtualenvwrapper/tmp/env1
239+
(env1)$ cdvirtualenv bin
240+
(env1)$ pwd
241+
/Users/dhellmann/Devel/virtualenvwrapper/tmp/env1/bin
145242

146243
cdsitepackages
147244
--------------
@@ -162,12 +259,17 @@ directory to change into.
162259

163260
::
164261

165-
$ workon pymotw
166-
$ echo $VIRTUAL_ENV
167-
/Users/dhellmann/.virtualenvs/pymotw
168-
$ cdsitepackages PyMOTW/bisect/
169-
$ pwd
170-
/Users/dhellmann/.virtualenvs/pymotw/lib/python2.6/site-packages/PyMOTW/bisect
262+
$ mkvirtualenv env1
263+
New python executable in env1/bin/python
264+
Installing distribute.............................................
265+
..................................................................
266+
..................................................................
267+
done.
268+
(env1)$ echo $VIRTUAL_ENV
269+
/Users/dhellmann/Devel/virtualenvwrapper/tmp/env1
270+
(env1)$ cdsitepackages PyMOTW/bisect/
271+
(env1)$ pwd
272+
/Users/dhellmann/Devel/virtualenvwrapper/tmp/env1/lib/python2.6/site-packages/PyMOTW/bisect
171273

172274
lssitepackages
173275
--------------
@@ -179,6 +281,19 @@ Syntax::
179281

180282
lssitepackages
181283

284+
::
285+
286+
$ mkvirtualenv env1
287+
New python executable in env1/bin/python
288+
Installing distribute.............................................
289+
..................................................................
290+
..................................................................
291+
done.
292+
(env1)$ $ workon env1
293+
(env1)$ lssitepackages
294+
distribute-0.6.10-py2.6.egg pip-0.6.3-py2.6.egg
295+
easy-install.pth setuptools.pth
296+
182297
===============
183298
Path Management
184299
===============

docs/source/history.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ Dev
1616
- Made deactivation more robust, especially under ksh.
1717
- Use Python's ``tempfile`` module for creating temporary filenames
1818
safely and portably.
19+
- Fix a problem with ``virtualenvwrapper_show_workon_options`` that
20+
caused it to show ``*`` as the name of a virtualenv when no
21+
environments had yet been created.
1922

2023
2.0.2
2124

0 commit comments

Comments
 (0)