Add --stdlib-sources argument to check_sql_modules
We need to be able to run tools/check_sql_modules.py on the trace processor chrome stdlib, which will now live in the Chromium repo. In order to run the script from Chromium, we need to be able to provide the path to the chrome stdlib. For example, tools/check_sql_modules.py --stdlib-sources base/tracing/stdlib
Bug: b/287233783
Change-Id: I25faa3124d3579bed11b5fd5c7772843ea60d2e4
diff --git a/tools/check_sql_modules.py b/tools/check_sql_modules.py
index 8037fca..f50fdbd 100755
--- a/tools/check_sql_modules.py
+++ b/tools/check_sql_modules.py
@@ -16,6 +16,7 @@
# This tool checks that every SQL object created without prefix
# 'internal_' is documented with proper schema.
+import argparse
import os
import sys
@@ -26,9 +27,13 @@
def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ '--stdlib-sources',
+ default=os.path.join(ROOT_DIR, "src", "trace_processor", "stdlib"))
+ args = parser.parse_args()
errors = []
- metrics_sources = os.path.join(ROOT_DIR, "src", "trace_processor", "stdlib")
- for root, _, files in os.walk(metrics_sources, topdown=True):
+ for root, _, files in os.walk(args.stdlib_sources, topdown=True):
for f in files:
path = os.path.join(root, f)
if not path.endswith(".sql"):