File tree Expand file tree Collapse file tree 5 files changed +34
-3
lines changed Expand file tree Collapse file tree 5 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,16 @@ cdsitepackages
84
84
85
85
Because the exact path to the site-packages directory in the virtualenv depends on the
86
86
version of Python, ``cdsitepackages `` is provided as a shortcut for ``cdvirtualenv
87
- lib/python${pyvers}/site-packages ``.
87
+ lib/python${pyvers}/site-packages ``. An optional argument is also allowed, to specify
88
+ a directory hierarchy within the ``site-packages `` directory to change into.
89
+
90
+ ::
91
+ $ workon pymotw
92
+ $ echo $VIRTUAL_ENV
93
+ /Users/dhellmann/.virtualenvs/pymotw
94
+ $ cdsitepackages PyMOTW/bisect/
95
+ $ pwd
96
+ /Users/dhellmann/.virtualenvs/pymotw/lib/python2.6/site-packages/PyMOTW/bisect
88
97
89
98
===============
90
99
Path Management
Original file line number Diff line number Diff line change 2
2
Release History
3
3
===============
4
4
5
+ 1.25
6
+
7
+ - Merged in changes to cdsitepackages from William McVey. It now
8
+ takes an argument and supports tab-completion for directories
9
+ within site-packages.
10
+
5
11
1.24.2
6
12
7
13
- Add user provided :ref: `tips-and-tricks ` section.
Original file line number Diff line number Diff line change 27
27
28
28
# What project are we building?
29
29
PROJECT = 'virtualenvwrapper'
30
- VERSION = '1.24.2 '
30
+ VERSION = '1.25 '
31
31
os .environ ['VERSION' ] = VERSION
32
32
33
33
# Read the long description to give to setup
Original file line number Diff line number Diff line change @@ -82,6 +82,16 @@ test_cdsitepackages () {
82
82
popd > /dev/null
83
83
}
84
84
85
+ test_cdsitepackages_with_arg () {
86
+ pushd " $( pwd) " > /dev/null
87
+ pyvers=$( python -V 2>&1 | cut -f2 -d' ' | cut -f1-2 -d.)
88
+ sitepackage_subdir=" $VIRTUAL_ENV /lib/python${pyvers} /site-packages/subdir"
89
+ mkdir -p " ${sitepackage_subdir} "
90
+ cdsitepackages subdir
91
+ assertSame " $sitepackage_subdir " " $( pwd) "
92
+ popd > /dev/null
93
+ }
94
+
85
95
test_mkvirtualenv_activates () {
86
96
mkvirtualenv " env2"
87
97
assertTrue virtualenvwrapper_verify_active_environment
Original file line number Diff line number Diff line change @@ -316,7 +316,13 @@ if [ -n "$BASH" ] ; then
316
316
# COMPREPLY=( $(compgen -d -- "${VIRTUAL_ENV}/${cur}" | sed -e "s@${VIRTUAL_ENV}/@@" ) )
317
317
COMPREPLY=( $( cdvirtualenv && compgen -d -- " ${cur} " ) )
318
318
}
319
+ _cdsitepackages_complete ()
320
+ {
321
+ local cur=" $2 "
322
+ COMPREPLY=( $( cdsitepackages && compgen -d -- " ${cur} " ) )
323
+ }
319
324
complete -o nospace -F _cdvirtualenv_complete -S/ cdvirtualenv
325
+ complete -o nospace -F _cdsitepackages_complete -S/ cdsitepackages
320
326
complete -o default -o nospace -F _virtualenvs workon
321
327
complete -o default -o nospace -F _virtualenvs rmvirtualenv
322
328
elif [ -n " $ZSH_VERSION " ] ; then
@@ -388,7 +394,7 @@ function add2virtualenv () {
388
394
function cdsitepackages () {
389
395
virtualenvwrapper_verify_active_environment || return 1
390
396
site_packages=" ` virtualenvwrapper_get_site_packages_dir` "
391
- cd " $site_packages "
397
+ cd " $site_packages " / $1
392
398
}
393
399
394
400
# Does a ``cd`` to the root of the currently-active virtualenv.
You can’t perform that action at this time.
0 commit comments