Commits

Doug Hellmann committed e2600ae

support nondescructive argument to deactivate

  • Participants
  • Parent commits b948872

Comments (0)

Files changed (6)

File README.rst

-#################
-virtualenvwrapper
-#################
-
-virtualenvwrapper is a set of extensions to Ian Bicking's `virtualenv
-<http://pypi.python.org/pypi/virtualenv>`_ tool.  The extensions include
-wrappers for creating and deleting virtual environments and otherwise
-managing your development workflow, making it easier to work on more
-than one project at a time without introducing conflicts in their
-dependencies.
-
-========
-Features
-========
-
-1.  Organizes all of your virtual environments in one place.
-
-2.  Wrappers for creating, copying and deleting environments, including
-    user-configurable hooks.
-
-3.  Use a single command to switch between environments.
-
-4.  Tab completion for commands that take a virtual environment as
-    argument.
-
-5. User-configurable hooks for all operations.
-
-6. Plugin system for more creating sharable extensions.
-
-Rich Leland has created a short `screencast
-<http://mathematism.com/2009/jul/30/presentation-pip-and-virtualenv/>`__
-showing off the features of virtualenvwrapper.
-
-============
-Installation
-============
-
-See the `project documentation
-<http://www.doughellmann.com/docs/virtualenvwrapper/>`__ for
-installation and setup instructions.
-
-Upgrading from 1.x
-==================
-
-The shell script containing the wrapper functions has been renamed in
-the 2.x series to reflect the fact that shells other than bash are
-supported.  In your startup file, change ``source
-/usr/local/bin/virtualenvwrapper_bashrc`` to ``source
-/usr/local/bin/virtualenvwrapper.sh``.
-
-============
-Contributing
-============
-
-Before contributing new features to virtualenvwrapper core, consider
-whether they should be implemented as an extension instead.
-
-Refer to the `developers docs
-<http://www.doughellmann.com/docs/virtualenvwrapper/developers.html>`__
-for tips on contributing patches.
-
-=======
-License
-=======
-
-Copyright Doug Hellmann, All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Doug Hellmann not be used
-in advertising or publicity pertaining to distribution of the software
-without specific, written prior permission.
-
-DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
-USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-
-.. _BitBucket: http://bitbucket.org/dhellmann/virtualenvwrapper/overview/
+#################
+virtualenvwrapper
+#################
+
+virtualenvwrapper is a set of extensions to Ian Bicking's `virtualenv
+<http://pypi.python.org/pypi/virtualenv>`_ tool.  The extensions include
+wrappers for creating and deleting virtual environments and otherwise
+managing your development workflow, making it easier to work on more
+than one project at a time without introducing conflicts in their
+dependencies.
+
+========
+Features
+========
+
+1.  Organizes all of your virtual environments in one place.
+
+2.  Wrappers for creating, copying and deleting environments, including
+    user-configurable hooks.
+
+3.  Use a single command to switch between environments.
+
+4.  Tab completion for commands that take a virtual environment as
+    argument.
+
+5. User-configurable hooks for all operations.
+
+6. Plugin system for more creating sharable extensions.
+
+Rich Leland has created a short `screencast
+<http://mathematism.com/2009/jul/30/presentation-pip-and-virtualenv/>`__
+showing off the features of virtualenvwrapper.
+
+============
+Installation
+============
+
+See the `project documentation
+<http://www.doughellmann.com/docs/virtualenvwrapper/>`__ for
+installation and setup instructions.
+
+Upgrading from 1.x
+==================
+
+The shell script containing the wrapper functions has been renamed in
+the 2.x series to reflect the fact that shells other than bash are
+supported.  In your startup file, change ``source
+/usr/local/bin/virtualenvwrapper_bashrc`` to ``source
+/usr/local/bin/virtualenvwrapper.sh``.
+
+============
+Contributing
+============
+
+Before contributing new features to virtualenvwrapper core, consider
+whether they should be implemented as an extension instead.
+
+Refer to the `developers docs
+<http://www.doughellmann.com/docs/virtualenvwrapper/developers.html>`__
+for tips on contributing patches.
+
+=======
+License
+=======
+
+Copyright Doug Hellmann, All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Doug Hellmann not be used
+in advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.
+
+DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+.. _BitBucket: http://bitbucket.org/dhellmann/virtualenvwrapper/overview/

File docs/source/history.rst

 
   - Add support for ksh.  Thanks to Doug Latornell for doing the
     research on what needed to be changed.
-  - Switch to ``tempfile`` command for creating temporary hook files.
   - Test import of virtualenvwrapper.hook_loader on startup and report
     the error in a way that should help the user figure out how to fix
     it (issue #33).
     created (issue #30).
   - Added hooks around :ref:`command-cpvirtualenv`.
   - Made deactivation more robust, especially under ksh.
+  - Use Python's ``tempfile`` module for creating temporary filenames
+    safely and portably.
 
 2.0.2
 
 import sys
 
 try:
-    long_description = open('README.rst', 'rt').read()
+    long_description = open('README.txt', 'rt').read()
 except IOError:
     long_description = ''
 

File tests/test_cp.sh

 }
 
 tearDown() {
+    if type deactivate >/dev/null 2>&1
+    then 
+        deactivate
+    fi
     rm -rf "$WORKON_HOME"
 }
 
     assertSame "$expected" "$output"
     rm -f "$WORKON_HOME/premkvirtualenv"
     rm -f "$WORKON_HOME/postmkvirtualenv"
-    deactivate
 }
 
 . "$test_dir/shunit2"

File virtualenvwrapper.sh

     virtualenvwrapper_original_deactivate=`typeset -f deactivate | sed 's/deactivate/virtualenv_deactivate/g'`
     eval "$virtualenvwrapper_original_deactivate"
     unset -f deactivate >/dev/null 2>&1
-#     virtualenvwrapper_saved_deactivate=$(virtualenvwrapper_tempfile)
-#     $(typeset -f deactivate | sed 's/deactivate/original_deactivate/g' > $virtualenvwrapper_saved_deactivate)
-#     echo "original_deactivate" >> $virtualenvwrapper_saved_deactivate
-#     echo "SAVED: \"$virtualenvwrapper_saved_deactivate\""
-#     cat $virtualenvwrapper_saved_deactivate
 
     # Replace the deactivate() function with a wrapper.
     eval 'deactivate () {
         old_env=$(basename "$VIRTUAL_ENV")
         
         # Call the original function.
-        #source "$virtualenvwrapper_saved_deactivate"
-        #rm -f "$virtualenvwrapper_saved_deactivate"
-        virtualenv_deactivate
+        virtualenv_deactivate $1
 
         virtualenvwrapper_run_hook "post_deactivate" "$old_env"
 
-        # Remove this function
-        unset -f deactivate
+        if [ ! "$1" = "nondestructive" ]
+        then
+            # Remove this function
+            unset -f virtualenv_deactivate
+            unset -f deactivate
+        fi
 
     }'