From: Phil Sutter <phil@nwl.cc>
To: Shekhar Sharma <shekhar250198@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft v1] tests: json_echo: fix python3
Date: Mon, 27 May 2019 17:54:54 +0200 [thread overview]
Message-ID: <20190527155454.GY31548@orbyte.nwl.cc> (raw)
In-Reply-To: <20190524184409.466036-1-shekhar250198@gmail.com>
Hi,
On Sat, May 25, 2019 at 12:14:09AM +0530, Shekhar Sharma wrote:
> This patch converts the 'run-test.py' file to run on both python2 and python3.
>
> Signed-off-by: Shekhar Sharma <shekhar250198@gmail.com>
> ---
> tests/json_echo/run-test.py | 45 +++++++++++++++++++------------------
> 1 file changed, 23 insertions(+), 22 deletions(-)
>
> diff --git a/tests/json_echo/run-test.py b/tests/json_echo/run-test.py
> index 0132b139..f5c81b7d 100755
> --- a/tests/json_echo/run-test.py
> +++ b/tests/json_echo/run-test.py
> @@ -1,5 +1,7 @@
> #!/usr/bin/python2
If the script now runs with either python 2 or 3, maybe change the
shebang to just '/usr/bin/python'?
> +from nftables import Nftables
> +from __future__ import print_function
> import sys
> import os
> import json
> @@ -7,14 +9,13 @@ import json
> TESTS_PATH = os.path.dirname(os.path.abspath(__file__))
> sys.path.insert(0, os.path.join(TESTS_PATH, '../../py/'))
>
> -from nftables import Nftables
Are you aware that the import was put here deliberately after the call
to sys.path.insert()? Why did you decide to move the import call?
> # Change working directory to repository root
> os.chdir(TESTS_PATH + "/../..")
>
> if not os.path.exists('src/.libs/libnftables.so'):
> - print "The nftables library does not exist. " \
> - "You need to build the project."
> + print("The nftables library does not exist. " \
> + "You need to build the project.")
> sys.exit(1)
Drop the backslash here?
Cheers, Phil
next prev parent reply other threads:[~2019-05-27 15:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 18:44 [PATCH nft v1] tests: json_echo: fix python3 Shekhar Sharma
2019-05-27 15:54 ` Phil Sutter [this message]
2019-05-27 21:53 ` shekhar sharma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190527155454.GY31548@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=netfilter-devel@vger.kernel.org \
--cc=shekhar250198@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.