aboutsummaryrefslogtreecommitdiff
path: root/test/lint/lint-circular-dependencies.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/lint/lint-circular-dependencies.py')
-rwxr-xr-xtest/lint/lint-circular-dependencies.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/test/lint/lint-circular-dependencies.py b/test/lint/lint-circular-dependencies.py
index e04909c0a5..7ca2ec994b 100755
--- a/test/lint/lint-circular-dependencies.py
+++ b/test/lint/lint-circular-dependencies.py
@@ -6,7 +6,6 @@
#
# Check for circular dependencies
-import glob
import os
import re
import subprocess
@@ -32,17 +31,14 @@ CODE_DIR = "src"
def main():
circular_dependencies = []
exit_code = 0
- os.chdir(
- CODE_DIR
- ) # We change dir before globbing since glob.glob's root_dir option is only available in Python 3.10
- # Using glob.glob since subprocess.run's globbing won't work without shell=True
- files = []
- for path in ["*", "*/*", "*/*/*"]:
- for extension in ["h", "cpp"]:
- files.extend(glob.glob(f"{path}.{extension}"))
+ os.chdir(CODE_DIR)
+ files = subprocess.check_output(
+ ['git', 'ls-files', '--', '*.h', '*.cpp'],
+ universal_newlines=True,
+ ).splitlines()
- command = ["python3", "../contrib/devtools/circular-dependencies.py", *files]
+ command = [sys.executable, "../contrib/devtools/circular-dependencies.py", *files]
dependencies_output = subprocess.run(
command,
stdout=subprocess.PIPE,