diff options
author | Mark Haines <mark.haines@matrix.org> | 2016-02-05 15:43:27 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2016-02-05 15:43:27 +0000 |
commit | 77c7ed0e93bff2ef7bb1981bf1b9a996aaca6f19 (patch) | |
tree | 7d98993ffc27a2ebd1ea7dce908ffbc9c4f05376 /scripts-dev/list_url_patterns.py | |
parent | List the URL patterns in synapse (diff) | |
download | synapse-77c7ed0e93bff2ef7bb1981bf1b9a996aaca6f19.tar.xz |
Report the v1 and v2 patterns separately
Diffstat (limited to 'scripts-dev/list_url_patterns.py')
-rwxr-xr-x | scripts-dev/list_url_patterns.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/scripts-dev/list_url_patterns.py b/scripts-dev/list_url_patterns.py index 23bcc6b034..58d40c4ff4 100755 --- a/scripts-dev/list_url_patterns.py +++ b/scripts-dev/list_url_patterns.py @@ -6,8 +6,13 @@ import os import sys import yaml -PATTERNS = [] +PATTERNS_V1 = [] +PATTERNS_V2 = [] +RESULT = { + "v1": PATTERNS_V1, + "v2": PATTERNS_V2, +} class CallVisitor(ast.NodeVisitor): def visit_Call(self, node): @@ -16,10 +21,11 @@ class CallVisitor(ast.NodeVisitor): else: return + if name == "client_path_patterns": - PATTERNS.append(node.args[0].s) + PATTERNS_V1.append(node.args[0].s) elif name == "client_v2_patterns": - PATTERNS.append(node.args[0].s) + PATTERNS_V2.append(node.args[0].s) def find_patterns_in_code(input_code): @@ -50,5 +56,7 @@ for directory in args.directories: filepath = os.path.join(root, filename) find_patterns_in_file(filepath) +PATTERNS_V1.sort() +PATTERNS_V2.sort() -yaml.dump(sorted(PATTERNS), sys.stdout, default_flow_style=False) +yaml.dump(RESULT, sys.stdout, default_flow_style=False) |