Changeset View
Changeset View
Standalone View
Standalone View
test/lint/check-rpc-mappings.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2017 The Bitcoin Core developers | # Copyright (c) 2017-2018 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""Check RPC argument consistency.""" | """Check RPC argument consistency.""" | ||||
from collections import defaultdict | from collections import defaultdict | ||||
import os | import os | ||||
import re | import re | ||||
import sys | import sys | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | with open(fname, "r", encoding="utf8") as f: | ||||
idx = int(m.group(2)) | idx = int(m.group(2)) | ||||
argname = parse_string(m.group(3)) | argname = parse_string(m.group(3)) | ||||
cmds.append((name, idx, argname)) | cmds.append((name, idx, argname)) | ||||
assert not in_rpcs and cmds | assert not in_rpcs and cmds | ||||
return cmds | return cmds | ||||
def main(): | def main(): | ||||
if len(sys.argv) != 2: | |||||
print('Usage: {} ROOT-DIR'.format(sys.argv[0]), file=sys.stderr) | |||||
sys.exit(1) | |||||
root = sys.argv[1] | root = sys.argv[1] | ||||
# Get all commands from dispatch tables | # Get all commands from dispatch tables | ||||
cmds = [] | cmds = [] | ||||
for fname in SOURCES: | for fname in SOURCES: | ||||
cmds += process_commands(os.path.join(root, fname)) | cmds += process_commands(os.path.join(root, fname)) | ||||
cmds_by_name = {} | cmds_by_name = {} | ||||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |