Skip to content

Commit eb84f82

Browse files
committed
py3k compatibility
1 parent 6f678bb commit eb84f82

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

tests/test_add2virtualenv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ test_add2virtualenv () {
3232
assertTrue "No path insert code in $(cat $path_file)" "grep -q sys.__egginsert $path_file"
3333
# Check the path we inserted is actually at the top
3434
expected="$full_path"
35-
actual=$($WORKON_HOME/pathtest/bin/python -c "import sys; print sys.path[1]")
35+
actual=$($WORKON_HOME/pathtest/bin/python -c "import sys; sys.stdout.write(sys.path[1]+'\n')")
3636
assertSame "$expected" "$actual"
3737
# Make sure the temporary file created
3838
# during the edit was removed

tests/test_support.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ setUp () {
2222
}
2323

2424
test_get_python_version () {
25-
expected="$(python -c 'import sys; print ".".join([str(p) for p in sys.version_info[:2]])')"
25+
expected="$(python -c 'import sys; sys.stdout.write(".".join([str(p) for p in sys.version_info[:2]])+'\n')')"
2626
echo "Expecting: $expected"
2727
vers=$(virtualenvwrapper_get_python_version)
2828
echo "Got : $vers"

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py27,py26
2+
envlist = py32,py27,py26
33

44
[testenv]
55
commands = bash ./tests/run_tests {envdir} []

virtualenvwrapper.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function virtualenvwrapper_derive_workon_home {
9999
# - Removing extra slashes (e.g., when TMPDIR ends in a slash)
100100
# - Expanding variables (e.g., $foo)
101101
# - Converting ~s to complete paths (e.g., ~/ to /home/brian/ and ~arthur to /home/arthur)
102-
workon_home_dir=$("$VIRTUALENVWRAPPER_PYTHON" -c "import os; print os.path.expandvars(os.path.expanduser(\"$workon_home_dir\"))")
102+
workon_home_dir=$("$VIRTUALENVWRAPPER_PYTHON" -c "import os,sys; sys.stdout.write(os.path.expandvars(os.path.expanduser(\"$workon_home_dir\"))+'\n')")
103103
fi
104104

105105
echo "$workon_home_dir"
@@ -656,7 +656,7 @@ function add2virtualenv {
656656

657657
for pydir in "$@"
658658
do
659-
absolute_path=$("$VIRTUALENVWRAPPER_PYTHON" -c "import os; print os.path.abspath(\"$pydir\")")
659+
absolute_path=$("$VIRTUALENVWRAPPER_PYTHON" -c "import os,sys; sys.stdout.write(os.path.abspath(\"$pydir\")+'\n')")
660660
if [ "$absolute_path" != "$pydir" ]
661661
then
662662
echo "Warning: Converting \"$pydir\" to \"$absolute_path\"" 1>&2
@@ -939,11 +939,11 @@ mktmpenv() {
939939
typeset RC
940940

941941
# Generate a unique temporary name
942-
tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import uuid; print uuid.uuid4()' 2>/dev/null)
942+
tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import uuid,sys; sys.stdout.write(uuid.uuid4()+"\n")' 2>/dev/null)
943943
if [ -z "$tmpenvname" ]
944944
then
945945
# This python does not support uuid
946-
tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import random; print hex(random.getrandbits(64))[2:-1]' 2>/dev/null)
946+
tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import random,sys; sys.stdout.write(hex(random.getrandbits(64))[2:-1]+"\n")' 2>/dev/null)
947947
fi
948948

949949
# Create the environment

virtualenvwrapper/hook_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def run_hooks(hook, options, args, output=None):
134134
continue
135135
plugin = ep.load()
136136
if options.listing:
137-
sys.stdout.write(' %-10s -- %s' % (ep.name, inspect.getdoc(plugin) or ''))
137+
sys.stdout.write(' %-10s -- %s\n' % (ep.name, inspect.getdoc(plugin) or ''))
138138
continue
139139
if options.sourcing:
140140
# Show the shell commands so they can

0 commit comments

Comments
 (0)