Commits

Doug Hellmann committed 23f5afc

Merge in changes to ``cdvirtualenv`` and error messages from wam. Add tests and docs.

  • Participants
  • Parent commits b87f352

Comments (0)

Files changed (3)

 Quickly Navigating to a virtualenv
 ==================================
 
-The functions ``cdsitepackages`` and ``cdvirtualenv`` provide quick shortcuts to quickly
-``cd`` into the ``site-packages`` directory of the currently-active virtualenv, and to the
-root of the currently-active virtualenv, respectively.
+There are two functions to provide shortcuts to navigate into the the currently-active
+virtualenv.
+
+cdvirtualenv
+============
+
+Calling ``cdvirtualenv`` changes the current working directory to the top of the virtualenv (``$VIRTUAL_ENV``).  An optional argument is appended to the path, allowing navigation directly into a subdirectory.
+
+::
+
+  $ workon pymotw
+  $ echo $VIRTUAL_ENV
+  /Users/dhellmann/.virtualenvs/pymotw
+  $ cdvirtualenv
+  $ pwd
+  /Users/dhellmann/.virtualenvs/pymotw
+  $ cdvirtualenv bin
+  $ pwd
+  /Users/dhellmann/.virtualenvs/pymotw/bin
+
+cdsitepackages
+==============
+
+Because the exact path to the site-packages directory in the virtualenv depends on the
+version of Python, ``cdsitepackages`` is provided as a shortcut for ``cdvirtualenv
+lib/python${pyvers}/site-packages``.
 
 ==========
 References
 Updates
 =======
 
+1.16
+
+  - Merged in changes to ``cdvirtualenv`` from wam and added tests and docs.
+  - Merged in changes to make error messages go to stderr, also provided by wam.
+
 1.15
   - Better error handling in mkvirtualenv.
   - Remove bogus VIRTUALENV_WRAPPER_BIN variable.
     pushd "$(pwd)" >/dev/null
     cdvirtualenv
     assertSame "$VIRTUAL_ENV" "$(pwd)"
+    cdvirtualenv bin
+    assertSame "$VIRTUAL_ENV/bin" "$(pwd)"
     popd >/dev/null
 }
 

virtualenvwrapper_bashrc

 function cdsitepackages () {
     virtualenvwrapper_verify_active_environment || return 1
     pyvers="`python -c 'import sys; print sys.version[:3]'`"
-    site_packages="$VIRTUAL_ENV/lib/python${pyvers}/site-packages"
-    cd $site_packages
+    site_packages="lib/python${pyvers}/site-packages"
+    cdvirtualenv $site_packages
 }
 
 #