Skip to content

Commit 037c5e5

Browse files
committed
Merge bitcoin/bitcoin#25042: lint: Fix lint-circular-dependencies.py file list
fad0abf lint: Fix lint-circular-dependencies.py file list (MacroFake) Pull request description: currently in-tree files like `wallet/test/fuzz/coinselection.cpp` are missed. Also out-of-tree files like `test/data/bip341_wallet_vectors.json.h` or `qt/moc_qvaluecombobox.cpp` are included. Change the script to only use in-tree files. Also, change `'python3'` to `sys.executable`. ACKs for top commit: laanwj: Code review ACK fad0abf Tree-SHA512: baf150fbae6a7120b2692f2eaef6a7773f2681e1610f8776f8d2ae6736c74736502a505df080b2182880f753b90f94e76a1e365fb45185f46f0e4d5521ca8e86
2 parents 5c93fc1 + fad0abf commit 037c5e5

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)