Skip to content

Commit 8b44d01

Browse files
committed
Merge bitcoin/bitcoin#28184: lint: fix custom mypy cache dir setting
f904777 lint: fix custom mypy cache dir setting (Fabian Jahr) Pull request description: fixes #28183 The custom cache dir for `mypy` can only be set via an environment variable, setting the `MYPY_CACHE_DIR` variable in the program is not sufficient. This error was introduced while translating the shell script to python. See also the mypy documentation: https://mypy.readthedocs.io/en/stable/config_file.html#confval-cache_dir ACKs for top commit: MarcoFalke: lgtm ACK f904777 Tree-SHA512: 7e8fb0cd06688129bd46d1afb8647262eb53d0f60b1ef6f288fedaa122d906fb62c9855e8bb0d6c6297d41a87a47d3cec7a00df55a7d033947937dfe23d07ba7
2 parents f66af92 + f904777 commit 8b44d01

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/lint/lint-python.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99
"""
1010

1111
import os
12+
from pathlib import Path
1213
import subprocess
1314
import sys
1415

1516
from importlib.metadata import metadata, PackageNotFoundError
1617

18+
# Customize mypy cache dir via environment variable
19+
cache_dir = Path(__file__).parent.parent / ".mypy_cache"
20+
os.environ["MYPY_CACHE_DIR"] = str(cache_dir)
1721

1822
DEPS = ['flake8', 'lief', 'mypy', 'pyzmq']
19-
MYPY_CACHE_DIR = f"{os.getenv('BASE_ROOT_DIR', '')}/test/.mypy_cache"
2023

2124
# All .py files, except those in src/ (to exclude subtrees there)
2225
FLAKE_FILES_ARGS = ['git', 'ls-files', '*.py', ':!:src/*.py']

0 commit comments

Comments
 (0)