summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorbhagyashris <bhagyashri.shewale@nttdata.com>2016-06-21 17:18:17 +0530
committerbhagyashris <bhagyashri.shewale@nttdata.com>2016-06-22 11:42:34 +0530
commitfa08854a6d11a60ea3d5f52490c7ee9db322ad69 (patch)
treeada55084a4a940a3e9f2f95c8ddbf6d16c7a7a74 /tools
parent6ea1a92aba15bd5cd8ac095014322be04e791e71 (diff)
downloadtrove-fa08854a6d11a60ea3d5f52490c7ee9db322ad69.tar.gz
Replace print statment with print function
In PY3, print should used as a function instead of a statement. This is PY27 compatible as well. For example, instances of the first case were replaced by the second case: >>> print 'help' File "<stdin>", line 1 print 'help' ^ SyntaxError: Missing parentheses in call to 'print' >>> print('help') help Partially implements: blueprint trove-python3 Change-Id: I21de65bc874d0fcfb51714857f8eaa97acb2f51d Closes-bug: #1594741
Diffstat (limited to 'tools')
-rwxr-xr-xtools/install_venv.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/tools/install_venv.py b/tools/install_venv.py
index ef44431f..21cdc30c 100755
--- a/tools/install_venv.py
+++ b/tools/install_venv.py
@@ -22,6 +22,8 @@
Installation script for Trove's development virtualenv
"""
+from __future__ import print_function
+
import os
import subprocess
import sys
@@ -35,7 +37,7 @@ PY_VERSION = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
def die(message, *args):
- print >> sys.stderr, message % args
+ print(message % args, file=sys.stderr)
sys.exit(1)
@@ -71,34 +73,34 @@ def check_dependencies():
"""Make sure virtualenv is in the path."""
if not HAS_VIRTUALENV:
- print 'not found.'
+ print('not found.')
# Try installing it via easy_install...
if HAS_EASY_INSTALL:
- print 'Installing virtualenv via easy_install...',
+ print('Installing virtualenv via easy_install...'),
if not (run_command(['which', 'easy_install']) and
run_command(['easy_install', 'virtualenv'])):
die('ERROR: virtualenv not found.\n\Trove development'
' requires virtualenv, please install it using your'
' favorite package management tool')
- print 'done.'
- print 'done.'
+ print('done.')
+ print('done.')
def create_virtualenv(venv=VENV):
"""Creates the virtual environment and installs PIP only into the
virtual environment
"""
- print 'Creating venv...',
+ print('Creating venv...'),
run_command(['virtualenv', '-q', '--no-site-packages', VENV])
- print 'done.'
- print 'Installing pip in virtualenv...',
+ print('done.')
+ print('Installing pip in virtualenv...'),
if not run_command(['tools/with_venv.sh', 'easy_install', 'pip']).strip():
die("Failed to install pip.")
- print 'done.'
+ print('done.')
def install_dependencies(venv=VENV):
- print 'Installing dependencies with pip (this can take a while)...'
+ print('Installing dependencies with pip (this can take a while)...')
# Install greenlet by hand - just listing it in the requires file does not
# get it in stalled in the right order
run_command(['tools/with_venv.sh', '-E', venv, 'pip', 'install',
@@ -133,7 +135,7 @@ def print_help():
Also, make test will automatically use the virtualenv.
"""
- print help
+ print(help)
def main(argv):