* [PATCH] docs: target: Convert tcm_mod_builder.py print syntax to python3
@ 2023-06-21 7:33 Rong Tao
2023-06-21 15:41 ` Bart Van Assche
0 siblings, 1 reply; 3+ messages in thread
From: Rong Tao @ 2023-06-21 7:33 UTC (permalink / raw)
To: martin.petersen
Cc: rongtao, Jonathan Corbet, open list:SCSI TARGET SUBSYSTEM,
open list:SCSI TARGET SUBSYSTEM, open list:DOCUMENTATION,
open list
From: Rong Tao <rongtao@cestc.cn>
Convert the tcm_mod_builder.py file to python3 and fix indentation.
Error:
$ ./tcm_mod_builder.py
File "/home/sda/git-repos/linux/Documentation/target/./tcm_mod_builder.py", line 23
print msg
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(msg)?
$ ./tcm_mod_builder.py
File "/home/sda/git-repos/linux/Documentation/target/./tcm_mod_builder.py", line 186
p = open(f, 'w');
TabError: inconsistent use of tabs and spaces in indentation
Signed-off-by: Rong Tao <rongtao@cestc.cn>
---
Documentation/target/tcm_mod_builder.py | 44 ++++++++++++-------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/Documentation/target/tcm_mod_builder.py b/Documentation/target/tcm_mod_builder.py
index 54492aa813b9..e2ef72925de3 100755
--- a/Documentation/target/tcm_mod_builder.py
+++ b/Documentation/target/tcm_mod_builder.py
@@ -20,7 +20,7 @@ fabric_mod_port = ""
fabric_mod_init_port = ""
def tcm_mod_err(msg):
- print msg
+ print(msg)
sys.exit(1)
def tcm_mod_create_module_subdir(fabric_mod_dir_var):
@@ -28,7 +28,7 @@ def tcm_mod_create_module_subdir(fabric_mod_dir_var):
if os.path.isdir(fabric_mod_dir_var) == True:
return 1
- print "Creating fabric_mod_dir: " + fabric_mod_dir_var
+ print("Creating fabric_mod_dir: " + fabric_mod_dir_var)
ret = os.mkdir(fabric_mod_dir_var)
if ret:
tcm_mod_err("Unable to mkdir " + fabric_mod_dir_var)
@@ -41,7 +41,7 @@ def tcm_mod_build_FC_include(fabric_mod_dir_var, fabric_mod_name):
buf = ""
f = fabric_mod_dir_var + "/" + fabric_mod_name + "_base.h"
- print "Writing file: " + f
+ print("Writing file: " + f)
p = open(f, 'w');
if not p:
@@ -85,7 +85,7 @@ def tcm_mod_build_SAS_include(fabric_mod_dir_var, fabric_mod_name):
buf = ""
f = fabric_mod_dir_var + "/" + fabric_mod_name + "_base.h"
- print "Writing file: " + f
+ print("Writing file: " + f)
p = open(f, 'w');
if not p:
@@ -128,7 +128,7 @@ def tcm_mod_build_iSCSI_include(fabric_mod_dir_var, fabric_mod_name):
buf = ""
f = fabric_mod_dir_var + "/" + fabric_mod_name + "_base.h"
- print "Writing file: " + f
+ print("Writing file: " + f)
p = open(f, 'w');
if not p:
@@ -172,7 +172,7 @@ def tcm_mod_build_base_includes(proto_ident, fabric_mod_dir_val, fabric_mod_name
elif proto_ident == "iSCSI":
tcm_mod_build_iSCSI_include(fabric_mod_dir_val, fabric_mod_name)
else:
- print "Unsupported proto_ident: " + proto_ident
+ print("Unsupported proto_ident: " + proto_ident)
sys.exit(1)
return
@@ -181,11 +181,11 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
buf = ""
f = fabric_mod_dir_var + "/" + fabric_mod_name + "_configfs.c"
- print "Writing file: " + f
+ print("Writing file: " + f)
- p = open(f, 'w');
- if not p:
- tcm_mod_err("Unable to open file: " + f)
+ p = open(f, 'w');
+ if not p:
+ tcm_mod_err("Unable to open file: " + f)
buf = "#include <linux/module.h>\n"
buf += "#include <linux/moduleparam.h>\n"
@@ -339,7 +339,7 @@ def tcm_mod_scan_fabric_ops(tcm_dir):
fabric_ops_api = tcm_dir + "include/target/target_core_fabric.h"
- print "Using tcm_mod_scan_fabric_ops: " + fabric_ops_api
+ print("Using tcm_mod_scan_fabric_ops: " + fabric_ops_api)
process_fo = 0;
p = open(fabric_ops_api, 'r')
@@ -375,14 +375,14 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
bufi = ""
f = fabric_mod_dir_var + "/" + fabric_mod_name + "_fabric.c"
- print "Writing file: " + f
+ print("Writing file: " + f)
p = open(f, 'w')
if not p:
tcm_mod_err("Unable to open file: " + f)
fi = fabric_mod_dir_var + "/" + fabric_mod_name + "_fabric.h"
- print "Writing file: " + fi
+ print("Writing file: " + fi)
pi = open(fi, 'w')
if not pi:
@@ -537,7 +537,7 @@ def tcm_mod_build_kbuild(fabric_mod_dir_var, fabric_mod_name):
buf = ""
f = fabric_mod_dir_var + "/Makefile"
- print "Writing file: " + f
+ print("Writing file: " + f)
p = open(f, 'w')
if not p:
@@ -558,7 +558,7 @@ def tcm_mod_build_kconfig(fabric_mod_dir_var, fabric_mod_name):
buf = ""
f = fabric_mod_dir_var + "/Kconfig"
- print "Writing file: " + f
+ print("Writing file: " + f)
p = open(f, 'w')
if not p:
@@ -603,20 +603,20 @@ def main(modname, proto_ident):
tcm_dir = os.getcwd();
tcm_dir += "/../../"
- print "tcm_dir: " + tcm_dir
+ print("tcm_dir: " + tcm_dir)
fabric_mod_name = modname
fabric_mod_dir = tcm_dir + "drivers/target/" + fabric_mod_name
- print "Set fabric_mod_name: " + fabric_mod_name
- print "Set fabric_mod_dir: " + fabric_mod_dir
- print "Using proto_ident: " + proto_ident
+ print("Set fabric_mod_name: " + fabric_mod_name)
+ print("Set fabric_mod_dir: " + fabric_mod_dir)
+ print("Using proto_ident: " + proto_ident)
if proto_ident != "FC" and proto_ident != "SAS" and proto_ident != "iSCSI":
- print "Unsupported proto_ident: " + proto_ident
+ print("Unsupported proto_ident: " + proto_ident)
sys.exit(1)
ret = tcm_mod_create_module_subdir(fabric_mod_dir)
if ret:
- print "tcm_mod_create_module_subdir() failed because module already exists!"
+ print("tcm_mod_create_module_subdir() failed because module already exists!")
sys.exit(1)
tcm_mod_build_base_includes(proto_ident, fabric_mod_dir, fabric_mod_name)
@@ -647,7 +647,7 @@ parser.add_option('-p', '--protoident', help='Protocol Ident', dest='protoident'
mandatories = ['modname', 'protoident']
for m in mandatories:
if not opts.__dict__[m]:
- print "mandatory option is missing\n"
+ print("mandatory option is missing\n")
parser.print_help()
exit(-1)
--
2.39.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] docs: target: Convert tcm_mod_builder.py print syntax to python3
2023-06-21 7:33 [PATCH] docs: target: Convert tcm_mod_builder.py print syntax to python3 Rong Tao
@ 2023-06-21 15:41 ` Bart Van Assche
2023-06-25 0:53 ` Rong Tao
0 siblings, 1 reply; 3+ messages in thread
From: Bart Van Assche @ 2023-06-21 15:41 UTC (permalink / raw)
To: Rong Tao, martin.petersen
Cc: rongtao, Jonathan Corbet, open list:SCSI TARGET SUBSYSTEM,
open list:SCSI TARGET SUBSYSTEM, open list:DOCUMENTATION,
open list, Mike Christie
On 6/21/23 00:33, Rong Tao wrote:
> diff --git a/Documentation/target/tcm_mod_builder.py b/Documentation/target/tcm_mod_builder.py
> index 54492aa813b9..e2ef72925de3 100755
> --- a/Documentation/target/tcm_mod_builder.py
> +++ b/Documentation/target/tcm_mod_builder.py
> @@ -20,7 +20,7 @@ fabric_mod_port = ""
> fabric_mod_init_port = ""
>
> def tcm_mod_err(msg):
> - print msg
> + print(msg)
> sys.exit(1)
How about deleting the file Documentation/target/tcm_mod_builder.py? I
don't think anyone is using this script. Additionally, it takes effort
to keep this script in sync with the rest of the SCSI target code. I'm
not sure anyone is interested in maintaining this script.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: [PATCH] docs: target: Convert tcm_mod_builder.py print syntax to python3
2023-06-21 15:41 ` Bart Van Assche
@ 2023-06-25 0:53 ` Rong Tao
0 siblings, 0 replies; 3+ messages in thread
From: Rong Tao @ 2023-06-25 0:53 UTC (permalink / raw)
To: bvanassche
Cc: corbet, linux-doc, linux-kernel, linux-scsi, martin.petersen,
michael.christie, rongtao, rtoax, target-devel
Sorry for the late reply, I just submit v2[0], remove tcm_mod_builder.py
totally. Please review.
Thanks,
Rong Tao.
[0] https://lore.kernel.org/lkml/tencent_E3643D5F0AA8CCBEF28C6A233A18B808CD0A@qq.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-25 0:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-21 7:33 [PATCH] docs: target: Convert tcm_mod_builder.py print syntax to python3 Rong Tao
2023-06-21 15:41 ` Bart Van Assche
2023-06-25 0:53 ` Rong Tao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).