Skip to content

Commit 24c821d

Browse files
committed
fix #43 by switching the way the hook loader is run
1 parent ffe290b commit 24c821d

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2010-05-02 Doug Hellmann <[email protected]>
2+
3+
* virtualenvwrapper.sh (virtualenvwrapper_run_hook): Instead of
4+
-m, use -c so hooks can be run under Python 2.4.
5+
16
2010-04-29 Doug Hellmann <[email protected]>
27

38
* tests/test_workon.sh: Refactor deactivate tests into their own

Makefile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# Get the version of the app. This is used in the doc build.
22
export VERSION=$(shell python setup.py --version)
33

4+
# Locations of Python interpreter binaries
5+
PYTHON26=/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
6+
PYTHON25=/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
7+
PYTHON24=/Users/dhellmann/Devel/virtualenvwrapper/Python/2.4.6/bin/python2.4
8+
49
# The main version of Python supported.
5-
PRIMARY_PYTHON_VERSION=2.6
10+
PRIMARY_PYTHON_VERSION=$(PYTHON26)
611

712
# The test-quick pattern changes the definition of
813
# this variable to only run against a single version of python.
9-
ifeq ($(SUPPORTED_PYTHON_VERSIONS),)
10-
SUPPORTED_PYTHON_VERSIONS=2.5 2.6
14+
ifeq ($(PYTHON_BINARIES),)
15+
PYTHON_BINARIES=$(PRIMARY_PYHTON_VERSION) $(PYTHON25) $(PYTHON24)
1116
endif
1217

1318
SUPPORTED_SHELLS=bash sh ksh zsh
@@ -81,9 +86,9 @@ test-zsh:
8186
# - Install virtualenvwrapper into the new virtualenv
8287
# - Run each test script in tests
8388
test-loop:
84-
for py_ver in $(SUPPORTED_PYTHON_VERSIONS) ; do \
89+
for py_bin in $(PYTHON_BINARIES) ; do \
8590
(cd $$TMPDIR/ && rm -rf virtualenvwrapper-test-env \
86-
&& virtualenv -p /Library/Frameworks/Python.framework/Versions/$$py_ver/bin/python$$py_ver --no-site-packages virtualenvwrapper-test-env) \
91+
&& virtualenv -p $$py_bin --no-site-packages virtualenvwrapper-test-env) \
8792
|| exit 1 ; \
8893
$$TMPDIR/virtualenvwrapper-test-env/bin/python setup.py install || exit 1 ; \
8994
for test_script in $(wildcard tests/test*.sh) ; do \
@@ -96,7 +101,10 @@ test-loop:
96101
done
97102

98103
test-quick:
99-
SUPPORTED_PYTHON_VERSIONS=$(PRIMARY_PYTHON_VERSION) $(MAKE) test-bash
104+
PYTHON_BINARIES=$(PRIMARY_PYTHON_VERSION) $(MAKE) test-bash
105+
106+
test-24:
107+
PYTHON_BINARIES=$(PYTHON24) $(MAKE) test-bash
100108

101109
test-install:
102110
bash ./tests/manual_test_install.sh `pwd`/dist "$(VERSION)"

docs/en/history.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
Release History
33
===============
44

5+
Dev
6+
7+
- Switched hook loader execution to a form that works with Python
8+
2.4 to resolve `issue 43
9+
<http://bitbucket.org/dhellmann/virtualenvwrapper/issue/43/>`__.
10+
511
2.1.1
612

713
- Added `Spanish translation for the documentation

virtualenvwrapper.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ virtualenvwrapper_tempfile () {
9090
# Run the hooks
9191
virtualenvwrapper_run_hook () {
9292
# First anything that runs directly from the plugin
93-
"$VIRTUALENVWRAPPER_PYTHON" -m virtualenvwrapper.hook_loader $HOOK_VERBOSE_OPTION "$@"
93+
"$VIRTUALENVWRAPPER_PYTHON" -c 'from virtualenvwrapper.hook_loader import main; main()' $HOOK_VERBOSE_OPTION "$@"
9494
# Now anything that wants to run inside this shell
9595
hook_script="$(virtualenvwrapper_tempfile hook)"
96-
"$VIRTUALENVWRAPPER_PYTHON" -m virtualenvwrapper.hook_loader $HOOK_VERBOSE_OPTION \
96+
"$VIRTUALENVWRAPPER_PYTHON" -c 'from virtualenvwrapper.hook_loader import main; main()' $HOOK_VERBOSE_OPTION \
9797
--source "$@" >>"$hook_script"
9898
source "$hook_script"
9999
rm -f "$hook_script"

0 commit comments

Comments
 (0)