diff options
author | Eduardo Habkost | 2018-06-08 14:29:43 +0200 |
---|---|---|
committer | Eduardo Habkost | 2018-06-08 19:39:24 +0200 |
commit | f03868bd5653265e97b253102d77d83ea85efdea (patch) | |
tree | f524a2198bb8492e8502326a112d465892d255b0 /tests/docker | |
parent | Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180608'... (diff) | |
download | qemu-f03868bd5653265e97b253102d77d83ea85efdea.tar.gz qemu-f03868bd5653265e97b253102d77d83ea85efdea.tar.xz qemu-f03868bd5653265e97b253102d77d83ea85efdea.zip |
python: futurize -f libfuturize.fixes.fix_print_with_import
Change all Python code to use print as a function.
This is necessary for Python 3 compatibility.
Done using:
$ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \
sort -u | grep -v README.sh4)
$ futurize -w -f libfuturize.fixes.fix_print_with_import $py
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20180608122952.2009-2-ehabkost@redhat.com>
[ehabkost: fixup tests/docker/docker.py]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'tests/docker')
-rwxr-xr-x | tests/docker/docker.py | 17 | ||||
-rwxr-xr-x | tests/docker/travis.py | 15 |
2 files changed, 17 insertions, 15 deletions
diff --git a/tests/docker/docker.py b/tests/docker/docker.py index f8267586eb..306e14cf69 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -11,6 +11,7 @@ # or (at your option) any later version. See the COPYING file in # the top-level directory. +from __future__ import print_function import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), @@ -87,7 +88,7 @@ def _get_so_libs(executable): so_lib = search.groups()[1] libs.append("%s/%s" % (so_path, so_lib)) except subprocess.CalledProcessError: - print "%s had no associated libraries (static build?)" % (executable) + print("%s had no associated libraries (static build?)" % (executable)) return libs @@ -161,7 +162,7 @@ class Docker(object): continue if only_known and instance_uuid not in self._instances: continue - print "Terminating", i + print("Terminating", i) if active: self._do(["kill", i]) self._do(["rm", i]) @@ -288,7 +289,7 @@ class BuildCommand(SubCommand): if "--no-cache" not in argv and \ dkr.image_matches_dockerfile(tag, dockerfile): if not args.quiet: - print "Image is up to date." + print("Image is up to date.") else: # Create a docker context directory for the build docker_dir = tempfile.mkdtemp(prefix="docker_build") @@ -300,10 +301,10 @@ class BuildCommand(SubCommand): rc = subprocess.call(os.path.realpath(docker_pre), cwd=docker_dir, stdout=stdout) if rc == 3: - print "Skip" + print("Skip") return 0 elif rc != 0: - print "%s exited with code %d" % (docker_pre, rc) + print("%s exited with code %d" % (docker_pre, rc)) return 1 # Copy any extra files into the Docker context. These can be @@ -399,11 +400,11 @@ class ProbeCommand(SubCommand): try: docker = Docker() if docker._command[0] == "docker": - print "yes" + print("yes") elif docker._command[0] == "sudo": - print "sudo" + print("sudo") except Exception: - print "no" + print("no") return diff --git a/tests/docker/travis.py b/tests/docker/travis.py index 703a7fde85..ea1ef169e6 100755 --- a/tests/docker/travis.py +++ b/tests/docker/travis.py @@ -11,6 +11,7 @@ # or (at your option) any later version. See the COPYING file in # the top-level directory. +from __future__ import print_function import sys import yaml import itertools @@ -34,14 +35,14 @@ def main(): sys.stderr.write("Usage: %s <travis-file>\n" % sys.argv[0]) return 1 conf = load_yaml(sys.argv[1]) - print "\n".join((": ${%s}" % var for var in conf["env"]["global"])) + print("\n".join((": ${%s}" % var for var in conf["env"]["global"]))) for config in conf_iter(conf): - print "(" - print "\n".join(config["env"]) - print "alias cc=" + config["compiler"] - print "\n".join(conf["before_script"]) - print "\n".join(conf["script"]) - print ")" + print("(") + print("\n".join(config["env"])) + print("alias cc=" + config["compiler"]) + print("\n".join(conf["before_script"])) + print("\n".join(conf["script"])) + print(")") return 0 if __name__ == "__main__": |