Skip to content

Commit fad0abf

Browse files
author
MacroFake
committed
lint: Fix lint-circular-dependencies.py file list
1 parent becea48 commit fad0abf

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

test/lint/lint-circular-dependencies.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#
77
# Check for circular dependencies
88

9-
import glob
109
import os
1110
import re
1211
import subprocess
@@ -32,17 +31,14 @@
3231
def main():
3332
circular_dependencies = []
3433
exit_code = 0
35-
os.chdir(
36-
CODE_DIR
37-
) # We change dir before globbing since glob.glob's root_dir option is only available in Python 3.10
3834

39-
# Using glob.glob since subprocess.run's globbing won't work without shell=True
40-
files = []
41-
for path in ["*", "*/*", "*/*/*"]:
42-
for extension in ["h", "cpp"]:
43-
files.extend(glob.glob(f"{path}.{extension}"))
35+
os.chdir(CODE_DIR)
36+
files = subprocess.check_output(
37+
['git', 'ls-files', '--', '*.h', '*.cpp'],
38+
universal_newlines=True,
39+
).splitlines()
4440

45-
command = ["python3", "../contrib/devtools/circular-dependencies.py", *files]
41+
command = [sys.executable, "../contrib/devtools/circular-dependencies.py", *files]
4642
dependencies_output = subprocess.run(
4743
command,
4844
stdout=subprocess.PIPE,

test/lint/lint-format-strings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
def check_doctest():
3838
command = [
39-
'python3',
39+
sys.executable,
4040
'-m',
4141
'doctest',
4242
RUN_LINT_FILE,

0 commit comments

Comments
 (0)