Doug Hellmann avatar Doug Hellmann committed 9ee144c

add support for ksh (fixes #25)

Comments (0)

Files changed (4)

 SUPPORTED_PYTHON_VERSIONS=2.5 2.6
 endif
 
+SUPPORTED_SHELLS=bash sh ksh zsh
+
 # Default target is to show help
 help:
 	@echo "sdist          - Source distribution"
 # Testing
 TEST_SCRIPTS=$(wildcard tests/test*.sh)
 
-.PHONY: develop test test-bash test-sh test-zsh test-loop test-install
-test: test-bash test-sh test-zsh test-install
+test:
+	for name in $(SUPPORTED_SHELLS) ; do \
+		$(MAKE) test-$$name || exit 1 ; \
+	done
+	$(MAKE) test-install
 
 develop:
 	python setup.py develop
 
-test-bash:
-	TEST_SHELL=bash $(MAKE) test-loop
-
-test-sh:
-	TEST_SHELL=sh $(MAKE) test-loop
+test-%:
+	TEST_SHELL=$(subst test-,,$@) $(MAKE) test-loop
 
 test-zsh:
 	TEST_SHELL="zsh -o shwordsplit" $(MAKE) test-loop
 			|| exit 1 ; \
 		$$TMPDIR/virtualenvwrapper-test-env/bin/python setup.py install || exit 1 ; \
 		for test_script in $(wildcard tests/test*.sh) ; do \
+			echo ; \
 	 		echo '********************************************************************************' ; \
 			echo "Running $$test_script with $(TEST_SHELL) under Python $$py_ver" ; \
 			VIRTUALENVWRAPPER_PYTHON=$$TMPDIR/virtualenvwrapper-test-env/bin/python SHUNIT_PARENT=$$test_script $(TEST_SHELL) $$test_script || exit 1 ; \

docs/source/history.rst

 Release History
 ===============
 
+Dev
+
+  - Add support for ksh.
+
 2.0.2
 
   - Fixed issue #32, making virtualenvwrapper.user_scripts compatible
 }
 
 test_cdvirtual() {
-    pushd "$(pwd)" >/dev/null
+    start_dir="$(pwd)"
     cdvirtualenv
     assertSame "$VIRTUAL_ENV" "$(pwd)"
     cdvirtualenv bin
     assertSame "$VIRTUAL_ENV/bin" "$(pwd)"
-    popd >/dev/null
+    cd "$(start_dir)"
 }
 
 test_cdsitepackages () {
-    pushd "$(pwd)" >/dev/null   
+    start_dir="$(pwd)"
     cdsitepackages
     pyvers=$(python -V 2>&1 | cut -f2 -d' ' | cut -f1-2 -d.)
     sitepackages="$VIRTUAL_ENV/lib/python${pyvers}/site-packages"
     assertSame "$sitepackages" "$(pwd)"
-    popd >/dev/null
+    cd "$(start_dir)"
 }
 
 test_cdsitepackages_with_arg () {
-    pushd "$(pwd)" >/dev/null
+    start_dir="$(pwd)"
     pyvers=$(python -V 2>&1 | cut -f2 -d' ' | cut -f1-2 -d.)
     sitepackage_subdir="$VIRTUAL_ENV/lib/python${pyvers}/site-packages/subdir"
     mkdir -p "${sitepackage_subdir}"
     cdsitepackages subdir
     assertSame "$sitepackage_subdir" "$(pwd)"
-    popd >/dev/null
+    cd "$(start_dir)"
 }
 
 test_cdvirtualenv_no_workon_home () {

virtualenvwrapper.sh

 fi
 
 # Verify that the WORKON_HOME directory exists
-function virtualenvwrapper_verify_workon_home () {
+virtualenvwrapper_verify_workon_home () {
     if [ ! -d "$WORKON_HOME" ]
     then
         [ "$1" != "-q" ] && echo "ERROR: Virtual environments directory '$WORKON_HOME' does not exist.  Create it or set WORKON_HOME to an existing directory." >&2
 #HOOK_VERBOSE_OPTION="-v"
 
 # Run the hooks
-function virtualenvwrapper_run_hook () {
+virtualenvwrapper_run_hook () {
     # First anything that runs directly from the plugin
     "$VIRTUALENVWRAPPER_PYTHON" -m virtualenvwrapper.hook_loader $HOOK_VERBOSE_OPTION "$@"
     # Now anything that wants to run inside this shell
 }
 
 # Set up virtualenvwrapper properly
-function virtualenvwrapper_initialize () {
+virtualenvwrapper_initialize () {
     virtualenvwrapper_verify_workon_home -q || return 1
     virtualenvwrapper_run_hook "initialize"
 }
 virtualenvwrapper_initialize
 
 # Verify that virtualenv is installed and visible
-function virtualenvwrapper_verify_virtualenv () {
+virtualenvwrapper_verify_virtualenv () {
     venv=$(which virtualenv | grep -v "not found")
     if [ "$venv" = "" ]
     then
 }
 
 # Verify that the requested environment exists
-function virtualenvwrapper_verify_workon_environment () {
+virtualenvwrapper_verify_workon_environment () {
     typeset env_name="$1"
     if [ ! -d "$WORKON_HOME/$env_name" ]
     then
 }
 
 # Verify that the active environment exists
-function virtualenvwrapper_verify_active_environment () {
+virtualenvwrapper_verify_active_environment () {
     if [ ! -n "${VIRTUAL_ENV}" ] || [ ! -d "${VIRTUAL_ENV}" ]
     then
         echo "ERROR: no virtualenv active, or active virtualenv is missing" >&2
 # Usage: mkvirtualenv [options] ENVNAME
 # (where the options are passed directly to virtualenv)
 #
-function mkvirtualenv () {
+mkvirtualenv () {
     eval "envname=\$$#"
     virtualenvwrapper_verify_workon_home || return 1
     virtualenvwrapper_verify_virtualenv || return 1
 }
 
 # Remove an environment, in the WORKON_HOME.
-function rmvirtualenv () {
+rmvirtualenv () {
     typeset env_name="$1"
     virtualenvwrapper_verify_workon_home || return 1
     if [ "$env_name" = "" ]
 }
 
 # List the available environments.
-function virtualenvwrapper_show_workon_options () {
+virtualenvwrapper_show_workon_options () {
     virtualenvwrapper_verify_workon_home || return 1
     # NOTE: DO NOT use ls here because colorized versions spew control characters
     #       into the output list.
 #
 # Usage: workon [environment_name]
 #
-function workon () {
+workon () {
 	typeset env_name="$1"
 	if [ "$env_name" = "" ]
     then
     virtualenvwrapper_saved_deactivate=$(typeset -f deactivate)
 
     # Replace the deactivate() function with a wrapper.
-    eval 'function deactivate () {
+    eval 'deactivate () {
         # Call the local hook before the global so we can undo
         # any settings made by the local postactivate first.
         virtualenvwrapper_run_hook "pre_deactivate"
 fi
 
 # Prints the Python version string for the current interpreter.
-function virtualenvwrapper_get_python_version () {
+virtualenvwrapper_get_python_version () {
     python -c 'import sys; print ".".join(str(p) for p in sys.version_info[:2])'
 }
 
 # Prints the path to the site-packages directory for the current environment.
-function virtualenvwrapper_get_site_packages_dir () {
+virtualenvwrapper_get_site_packages_dir () {
     echo "$VIRTUAL_ENV/lib/python`virtualenvwrapper_get_python_version`/site-packages"    
 }
 
 # "virtualenv_path_extensions.pth" inside the virtualenv's
 # site-packages directory; if this file does not exist, it will be
 # created first.
-function add2virtualenv () {
+add2virtualenv () {
 
     virtualenvwrapper_verify_workon_home || return 1
     virtualenvwrapper_verify_active_environment || return 1
 
 # Does a ``cd`` to the site-packages directory of the currently-active
 # virtualenv.
-function cdsitepackages () {
+cdsitepackages () {
     virtualenvwrapper_verify_workon_home || return 1
     virtualenvwrapper_verify_active_environment || return 1
     site_packages="`virtualenvwrapper_get_site_packages_dir`"
 }
 
 # Does a ``cd`` to the root of the currently-active virtualenv.
-function cdvirtualenv () {
+cdvirtualenv () {
     virtualenvwrapper_verify_workon_home || return 1
     virtualenvwrapper_verify_active_environment || return 1
     cd $VIRTUAL_ENV/$1
 
 # Shows the content of the site-packages directory of the currently-active
 # virtualenv
-function lssitepackages () {
+lssitepackages () {
     virtualenvwrapper_verify_workon_home || return 1
     virtualenvwrapper_verify_active_environment || return 1
     site_packages="`virtualenvwrapper_get_site_packages_dir`"
 }
 
 # Duplicate the named virtualenv to make a new one.
-function cpvirtualenv() {
+cpvirtualenv() {
 
     typeset env_name="$1"
     if [ "$env_name" = "" ]
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.