Commits

Doug Hellmann committed b881427

fix lazy-loader function definitions under zsh; fixes #144

Comments (0)

Files changed (3)

docs/en/history.rst

   - Switch to stevedore_ for plugin management
   - mkvirtualenv_help should use ``$VIRTUALENVWRAPPER_PYTHON`` instead
     of calling ``virtualenv`` directly (:bbissue:`148`).
+  - Fix issue with lazy-loader code under zsh (:bbissue:`144`).
 
 .. _stevedore: http://pypi.python.org/pypi/stevedore
 

tests/test_lazy.sh

-#!/bin/sh
 
 test_dir=$(cd $(dirname $0) && pwd)
 source "$test_dir/setup.sh"
 oneTimeSetUp() {
     rm -rf "$WORKON_HOME"
     mkdir -p "$WORKON_HOME"
+    [ ! -z "$ZSH_VERSION" ] && unsetopt shwordsplit
     source "$test_dir/../virtualenvwrapper_lazy.sh"
+    [ ! -z "$ZSH_VERSION" ] && setopt shwordsplit
 }
 
 oneTimeTearDown() {
     name="$1"
     assertTrue "$name not defined" "type $name"
 	assertTrue "$name does not load virtualenvwrapper" "typeset -f $name | grep 'virtualenvwrapper_load'"
+    if [ "$name" = "mkvirtualenv" ]
+    then
+        lookfor="rmvirtualenv"
+    else
+        lookfor="mkvirtualenv"
+    fi
+	assertFalse "$name includes reference to $lookfor: $(typeset -f $name)" "typeset -f $name | grep $lookfor"
 }
 
 test_mkvirtualenv_defined_lazy() {

virtualenvwrapper_lazy.sh

 # Set up "alias" functions based on the API definition.
 function virtualenvwrapper_setup_lazy_loader {
     typeset venvw_name
-	for venvw_name in $_VIRTUALENVWRAPPER_API
+	for venvw_name in $(echo ${_VIRTUALENVWRAPPER_API})
 	do
 		eval "
 function $venvw_name {
 	virtualenvwrapper_load
-	$venvw_name \"\$@\"
+	${venvw_name} \"\$@\"
 }
 "
 	done
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.