Bug 1618620 - Convert ErrorList.py to py3; r=firefox-build-system-reviewers,rstewart

Differential Revision: https://phabricator.services.mozilla.com/D64621

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Shal 2020-02-28 00:28:17 +00:00
parent 449e9c0820
commit 43842108f2
2 changed files with 7 additions and 9 deletions

View File

@ -1233,11 +1233,11 @@ def error_list_h(output):
output.write("#define NS_ERROR_MODULE_BASE_OFFSET {}\n".format(MODULE_BASE_OFFSET))
for mod, val in modules.iteritems():
for mod, val in modules.items():
output.write("#define NS_ERROR_MODULE_{} {}\n".format(mod, val.num))
items = []
for error, val in errors.iteritems():
for error, val in errors.items():
items.append(" {} = 0x{:X}".format(error, val))
output.write("""
enum class nsresult : uint32_t
@ -1248,7 +1248,7 @@ enum class nsresult : uint32_t
""".format(",\n".join(items)))
items = []
for error, val in errors.iteritems():
for error, val in errors.items():
items.append(" {0} = nsresult::{0}".format(error))
output.write("""
@ -1285,7 +1285,7 @@ GetErrorNameInternal(nsresult rv)
# NOTE: Making sure we don't write out duplicate values is important as
# we're using a switch statement to implement this.
seen = set()
for error, val in errors.iteritems():
for error, val in errors.items():
if val not in seen:
output.write(' case nsresult::{0}: return "{0}";\n'.format(error))
seen.add(val)
@ -1312,9 +1312,9 @@ use super::nsresult;
output.write("pub const NS_ERROR_MODULE_BASE_OFFSET: nsresult = nsresult({});\n"
.format(MODULE_BASE_OFFSET))
for mod, val in modules.iteritems():
for mod, val in modules.items():
output.write("pub const NS_ERROR_MODULE_{}: nsresult = nsresult({});\n"
.format(mod, val.num))
for error, val in errors.iteritems():
for error, val in errors.items():
output.write("pub const {}: nsresult = nsresult(0x{:X});\n".format(error, val))

View File

@ -202,12 +202,10 @@ if CONFIG['OS_TARGET'] == 'WINNT':
'MemoryInfo.cpp',
]
GeneratedFile("ErrorList.h", script="ErrorList.py", entry_point="error_list_h", py2=True)
GeneratedFile("ErrorList.h", script="ErrorList.py", entry_point="error_list_h")
GeneratedFile("ErrorNamesInternal.h", script="ErrorList.py",
py2=True,
entry_point="error_names_internal_h")
GeneratedFile("error_list.rs", script="ErrorList.py",
py2=True,
entry_point="error_list_rs")
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':