summaryrefslogtreecommitdiffstats
path: root/update.py
diff options
context:
space:
mode:
authorChuck Short <chuck.short@canonical.com>2013-05-01 09:40:43 -0500
committerChuck Short <chuck.short@canonical.com>2013-05-02 08:06:01 -0500
commit2f771aca390639cc49f71c451bd55c1d10db6f58 (patch)
tree5873dda954d351f5522a7451acb1215b7c85ab7c /update.py
parent90e83530d4dc49d570fa05ea63a93805717dcfa0 (diff)
downloadoslo-2f771aca390639cc49f71c451bd55c1d10db6f58.tar.gz
oslo-2f771aca390639cc49f71c451bd55c1d10db6f58.tar.xz
oslo-2f771aca390639cc49f71c451bd55c1d10db6f58.zip
Improve python3 compatibility
Change print statements so that it works with python3 as well. Change-Id: Iff16b62e4b875c79862c9af7726ea77627aa7b4f Signed-off-by: Chuck Short <chuck.short@canonical.com>
Diffstat (limited to 'update.py')
-rw-r--r--update.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/update.py b/update.py
index 19ace44..f6ffd7c 100644
--- a/update.py
+++ b/update.py
@@ -55,6 +55,8 @@ the modules to copy and the base destination module
Obviously, the first way is the easiest!
"""
+from __future__ import print_function
+
import functools
import glob
import os
@@ -171,8 +173,8 @@ def _copy_pyfile(path, base, dest_dir):
def _copy_module(mod, base, dest_dir):
- print ("Copying openstack.common.%s under the %s module in %s" %
- (mod, base, dest_dir))
+ print(("Copying openstack.common.%s under the %s module in %s" %
+ (mod, base, dest_dir)))
copy_pyfile = functools.partial(_copy_pyfile,
base=base, dest_dir=dest_dir)
@@ -203,7 +205,7 @@ def _copy_module(mod, base, dest_dir):
for matches in [glob.glob(g) for g in globs_to_copy]:
for match in matches:
dest = os.path.join(dest_dir, match.replace('oslo', base))
- print "Copying %s to %s" % (match, dest)
+ print("Copying %s to %s" % (match, dest))
_copy_file(match, dest, base)
@@ -275,15 +277,15 @@ def main(argv):
dest_dir = os.path.dirname(conf.config_file[-1])
if not dest_dir or not os.path.isdir(dest_dir):
- print >> sys.stderr, "A valid destination dir is required"
+ print("A valid destination dir is required", file=sys.stderr)
sys.exit(1)
if not conf.module and not conf.modules:
- print >> sys.stderr, "A list of modules to copy is required"
+ print("A list of modules to copy is required", file=sys.stderr)
sys.exit(1)
if not conf.base:
- print >> sys.stderr, "A destination base module is required"
+ print("A destination base module is required", file=sys.stderr)
sys.exit(1)
_create_module_init(conf.base, dest_dir)