From: Bob Campbell Date: Thu, 12 Jan 2017 01:39:52 +0000 (+1300) Subject: errors: fix "generate python error codes for NTSTATUS" X-Git-Tag: talloc-2.1.9~187 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99e41a377e7b4c64a0a10c680c2a39237daa08dd;p=thirdparty%2Fsamba.git errors: fix "generate python error codes for NTSTATUS" Fixups according to feedback on the list. Signed-off-by: Bob Campbell Reviewed-by: Andrew Bartlett Reviewed-by: Garming Sam --- diff --git a/source4/scripting/bin/gen_ntstatus.py b/source4/scripting/bin/gen_ntstatus.py index dd0c3263274..4738177aa98 100755 --- a/source4/scripting/bin/gen_ntstatus.py +++ b/source4/scripting/bin/gen_ntstatus.py @@ -186,8 +186,9 @@ def generatePythonFile(out_file): out_file.write("\tm = Py_InitModule3(\"ntstatus\", NULL, \"NTSTATUS error defines\");\n"); out_file.write("\tif (m == NULL)\n"); out_file.write("\t\treturn;\n\n"); - for err in ErrorsToUse: - line = "\tPyModule_AddObject(m, \"%s\", ndr_PyLong_FromUnsignedLongLong(0x%08x));\n" % (err.err_define, err.err_code) + for err in Errors: + line = """\tPyModule_AddObject(m, \"%s\", + \t\tndr_PyLong_FromUnsignedLongLong(NT_STATUS_V(%s)));\n""" % (err.err_define, err.err_define) out_file.write(line) out_file.write("}\n"); @@ -253,23 +254,24 @@ def main (): sys.exit() # read in the data - file_contents = open(input_file1,"r") + file_contents = open(input_file1, "r") parseHeaderFile(file_contents) - file_contents = open(input_file2,"r") + file_contents = open(input_file2, "r") parseErrorDescriptions(file_contents, False) - file_contents = open(input_file3,"r") + file_contents = open(input_file3, "r") has_already_desc = file_contents.readlines() processErrorDescription(has_already_desc) - print "writing new headerfile: %s"%headerfile_name - out_file = open(headerfile_name,"w") + + print "writing new headerfile: %s" % headerfile_name + out_file = open(gen_headerfile_name, "w") generateHeaderFile(out_file) out_file.close() - print "writing new headerfile: %s"%sourcefile_name - out_file = open(sourcefile_name,"w") + print "writing new headerfile: %s" % sourcefile_name + out_file = open(sourcefile_name, "w") generateSourceFile(out_file) out_file.close() - print "writing new headerfile: %s"%pythonfile_name - out_file = open(pythonfile_name,"w") + print "writing new headerfile: %s" % pythonfile_name + out_file = open(pythonfile_name, "w") generatePythonFile(out_file) out_file.close()