{"id":813930,"url":"http://patchwork.ozlabs.org/api/patches/813930/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170914200634.17818-2-paul.burton@imgtec.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170914200634.17818-2-paul.burton@imgtec.com>","list_archive_url":null,"date":"2017-09-14T20:06:27","name":"[U-Boot,1/8] test/py: Make print statements python 3.x safe","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"89e6a51141db95a0d5334ca5c9097221b426574d","submitter":{"id":33698,"url":"http://patchwork.ozlabs.org/api/people/33698/?format=json","name":"Paul Burton","email":"paul.burton@imgtec.com"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170914200634.17818-2-paul.burton@imgtec.com/mbox/","series":[{"id":3156,"url":"http://patchwork.ozlabs.org/api/series/3156/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=3156","date":"2017-09-14T20:06:26","name":"test/py: Fixes for python 3.x","version":1,"mbox":"http://patchwork.ozlabs.org/series/3156/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/813930/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/813930/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xtV2B0vP0z9s7f\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 06:07:46 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid BAF66C21E68; Thu, 14 Sep 2017 20:07:33 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 67B8DC21E26;\n\tThu, 14 Sep 2017 20:07:30 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 5EF22C21DA4; Thu, 14 Sep 2017 20:07:18 +0000 (UTC)","from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196])\n\tby lists.denx.de (Postfix) with ESMTP id 18102C21DA4\n\tfor <u-boot@lists.denx.de>; Thu, 14 Sep 2017 20:07:17 +0000 (UTC)","from hhmail02.hh.imgtec.org (unknown [10.100.10.20])\n\tby Forcepoint Email with ESMTPS id F1E6C78475BEC;\n\tThu, 14 Sep 2017 21:07:10 +0100 (IST)","from localhost (10.20.1.88) by hhmail02.hh.imgtec.org\n\t(10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0;\n\tThu, 14 Sep 2017 21:07:15 +0100"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE\n\tautolearn=unavailable autolearn_force=no version=3.4.0","From":"Paul Burton <paul.burton@imgtec.com>","To":"<u-boot@lists.denx.de>","Date":"Thu, 14 Sep 2017 13:06:27 -0700","Message-ID":"<20170914200634.17818-2-paul.burton@imgtec.com>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170914200634.17818-1-paul.burton@imgtec.com>","References":"<20170914200634.17818-1-paul.burton@imgtec.com>","MIME-Version":"1.0","X-Originating-IP":"[10.20.1.88]","Cc":"Stephen Warren <swarren@nvidia.com>, =?utf-8?q?Stefan_Br=C3=BCns?=\n\t<stefan.bruens@rwth-aachen.de>","Subject":"[U-Boot] [PATCH 1/8] test/py: Make print statements python 3.x safe","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"In python 3.x print must be called as a function rather than used as a\nstatement. Update uses of print to the function call syntax in order to\nbe python 3.x safe.\n\nSigned-off-by: Paul Burton <paul.burton@imgtec.com>\n---\n\n test/py/conftest.py               |  2 +-\n test/py/test.py                   |  6 ++++--\n test/py/tests/test_fit.py         | 12 +++++++-----\n test/py/u_boot_console_sandbox.py |  2 +-\n test/py/u_boot_spawn.py           |  2 +-\n 5 files changed, 14 insertions(+), 10 deletions(-)","diff":"diff --git a/test/py/conftest.py b/test/py/conftest.py\nindex 65e1d75626..ced96f1006 100644\n--- a/test/py/conftest.py\n+++ b/test/py/conftest.py\n@@ -545,7 +545,7 @@ def pytest_runtest_protocol(item, nextitem):\n         # is fixed, if this exception still exists, it will then be logged as\n         # part of the test's stdout.\n         import traceback\n-        print 'Exception occurred while logging runtest status:'\n+        print('Exception occurred while logging runtest status:')\n         traceback.print_exc()\n         # FIXME: Can we force a test failure here?\n \ndiff --git a/test/py/test.py b/test/py/test.py\nindex 74e560a4d3..215f2651a7 100755\n--- a/test/py/test.py\n+++ b/test/py/test.py\n@@ -8,6 +8,8 @@\n # Wrapper script to invoke pytest with the directory name that contains the\n # U-Boot tests.\n \n+from __future__ import print_function\n+\n import os\n import os.path\n import sys\n@@ -27,7 +29,7 @@ except:\n     traceback.print_exc()\n     # Hint to the user that they likely simply haven't installed the required\n     # dependencies.\n-    print >>sys.stderr, '''\n+    print('''\n exec(py.test) failed; perhaps you are missing some dependencies?\n-See test/py/README.md for the list.'''\n+See test/py/README.md for the list.''', file=sys.stderr)\n     sys.exit(1)\ndiff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py\nindex 7e6b96dae4..29b2491f89 100755\n--- a/test/py/tests/test_fit.py\n+++ b/test/py/tests/test_fit.py\n@@ -4,6 +4,8 @@\n #\n # Sanity check of the FIT handling in U-Boot\n \n+from __future__ import print_function\n+\n import os\n import pytest\n import struct\n@@ -153,7 +155,7 @@ def test_fit(u_boot_console):\n         src = make_fname('u-boot.dts')\n         dtb = make_fname('u-boot.dtb')\n         with open(src, 'w') as fd:\n-            print >> fd, base_fdt\n+            print(base_fdt, file=fd)\n         util.run_and_log(cons, ['dtc', src, '-O', 'dtb', '-o', dtb])\n         return dtb\n \n@@ -167,7 +169,7 @@ def test_fit(u_boot_console):\n         \"\"\"\n         its = make_fname('test.its')\n         with open(its, 'w') as fd:\n-            print >> fd, base_its % params\n+            print(base_its % params, file=fd)\n         return its\n \n     def make_fit(mkimage, params):\n@@ -186,7 +188,7 @@ def test_fit(u_boot_console):\n         its = make_its(params)\n         util.run_and_log(cons, [mkimage, '-f', its, fit])\n         with open(make_fname('u-boot.dts'), 'w') as fd:\n-            print >> fd, base_fdt\n+            print(base_fdt, file=fd)\n         return fit\n \n     def make_kernel(filename, text):\n@@ -202,7 +204,7 @@ def test_fit(u_boot_console):\n         for i in range(100):\n             data += 'this %s %d is unlikely to boot\\n' % (text, i)\n         with open(fname, 'w') as fd:\n-            print >> fd, data\n+            print(data, file=fd)\n         return fname\n \n     def make_ramdisk(filename, text):\n@@ -216,7 +218,7 @@ def test_fit(u_boot_console):\n         for i in range(100):\n             data += '%s %d was seldom used in the middle ages\\n' % (text, i)\n         with open(fname, 'w') as fd:\n-            print >> fd, data\n+            print(data, file=fd)\n         return fname\n \n     def find_matching(text, match):\ndiff --git a/test/py/u_boot_console_sandbox.py b/test/py/u_boot_console_sandbox.py\nindex 647e1f879f..9a2fe9cb59 100644\n--- a/test/py/u_boot_console_sandbox.py\n+++ b/test/py/u_boot_console_sandbox.py\n@@ -42,7 +42,7 @@ class ConsoleSandbox(ConsoleBase):\n         bcfg = self.config.buildconfig\n         config_spl = bcfg.get('config_spl', 'n') == 'y'\n         fname = '/spl/u-boot-spl' if config_spl else '/u-boot'\n-        print fname\n+        print(fname)\n         cmd = []\n         if self.config.gdbserver:\n             cmd += ['gdbserver', self.config.gdbserver]\ndiff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py\nindex 3a0fbfad90..15ca4ac838 100644\n--- a/test/py/u_boot_spawn.py\n+++ b/test/py/u_boot_spawn.py\n@@ -59,7 +59,7 @@ class Spawn(object):\n                     os.chdir(cwd)\n                 os.execvp(args[0], args)\n             except:\n-                print 'CHILD EXECEPTION:'\n+                print('CHILD EXECEPTION:')\n                 import traceback\n                 traceback.print_exc()\n             finally:\n","prefixes":["U-Boot","1/8"]}