Commits

Anonymous committed 40781f5

py3k compatibility

Comments (0)

Files changed (5)

tests/test_add2virtualenv.sh

     assertTrue "No path insert code in $(cat $path_file)" "grep -q sys.__egginsert $path_file"
     # Check the path we inserted is actually at the top
     expected="$full_path"
-    actual=$($WORKON_HOME/pathtest/bin/python -c "import sys; print sys.path[1]")
+    actual=$($WORKON_HOME/pathtest/bin/python -c "import sys; sys.stdout.write(sys.path[1]+'\n')")
     assertSame "$expected" "$actual"
     # Make sure the temporary file created
     # during the edit was removed

tests/test_support.sh

 }
 
 test_get_python_version () {
-    expected="$(python -c 'import sys; print ".".join([str(p) for p in sys.version_info[:2]])')"
+    expected="$(python -c 'import sys; sys.stdout.write(".".join([str(p) for p in sys.version_info[:2]])+'\n')')"
     echo "Expecting: $expected"
     vers=$(virtualenvwrapper_get_python_version)
     echo "Got      : $vers"
 [tox]
-envlist = py27,py26
+envlist = py32,py27,py26
 
 [testenv]
 commands = bash ./tests/run_tests {envdir} []
         # - Removing extra slashes (e.g., when TMPDIR ends in a slash)
         # - Expanding variables (e.g., $foo)
         # - Converting ~s to complete paths (e.g., ~/ to /home/brian/ and ~arthur to /home/arthur)
-        workon_home_dir=$("$VIRTUALENVWRAPPER_PYTHON" -c "import os; print os.path.expandvars(os.path.expanduser(\"$workon_home_dir\"))")
+        workon_home_dir=$("$VIRTUALENVWRAPPER_PYTHON" -c "import os,sys; sys.stdout.write(os.path.expandvars(os.path.expanduser(\"$workon_home_dir\"))+'\n')")
     fi
 
     echo "$workon_home_dir"
 
     for pydir in "$@"
     do
-        absolute_path=$("$VIRTUALENVWRAPPER_PYTHON" -c "import os; print os.path.abspath(\"$pydir\")")
+        absolute_path=$("$VIRTUALENVWRAPPER_PYTHON" -c "import os,sys; sys.stdout.write(os.path.abspath(\"$pydir\")+'\n')")
         if [ "$absolute_path" != "$pydir" ]
         then
             echo "Warning: Converting \"$pydir\" to \"$absolute_path\"" 1>&2
     typeset RC
 
     # Generate a unique temporary name
-    tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import uuid; print uuid.uuid4()' 2>/dev/null)
+    tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import uuid,sys; sys.stdout.write(uuid.uuid4()+"\n")' 2>/dev/null)
     if [ -z "$tmpenvname" ]
     then
         # This python does not support uuid
-        tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import random; print hex(random.getrandbits(64))[2:-1]' 2>/dev/null)
+        tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import random,sys; sys.stdout.write(hex(random.getrandbits(64))[2:-1]+"\n")' 2>/dev/null)
     fi
 
     # Create the environment

virtualenvwrapper/hook_loader.py

             continue
         plugin = ep.load()
         if options.listing:
-            sys.stdout.write('  %-10s -- %s' % (ep.name, inspect.getdoc(plugin) or ''))
+            sys.stdout.write('  %-10s -- %s\n' % (ep.name, inspect.getdoc(plugin) or ''))
             continue
         if options.sourcing:
             # Show the shell commands so they can