aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-10-02 11:18:50 +0200
committerfanquake <fanquake@gmail.com>2023-10-02 11:19:08 +0200
commit8b44d011184c7d807bc6e61107116ed05c45b8d1 (patch)
treebe4c94966067687beb7522bebde483be4357716d /test
parentf66af92f1a3e2ebbae8050e57a60e051f9bf5f39 (diff)
parentf9047771d642c5887c752872b6ffbbd974603b35 (diff)
downloadbitcoin-8b44d011184c7d807bc6e61107116ed05c45b8d1.tar.xz
Merge bitcoin/bitcoin#28184: lint: fix custom mypy cache dir setting
f9047771d642c5887c752872b6ffbbd974603b35 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 f9047771d642c5887c752872b6ffbbd974603b35 Tree-SHA512: 7e8fb0cd06688129bd46d1afb8647262eb53d0f60b1ef6f288fedaa122d906fb62c9855e8bb0d6c6297d41a87a47d3cec7a00df55a7d033947937dfe23d07ba7
Diffstat (limited to 'test')
-rwxr-xr-xtest/lint/lint-python.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/lint/lint-python.py b/test/lint/lint-python.py
index 6010c787cb..eabd13322e 100755
--- a/test/lint/lint-python.py
+++ b/test/lint/lint-python.py
@@ -9,14 +9,17 @@ Check for specified flake8 and mypy warnings in python files.
"""
import os
+from pathlib import Path
import subprocess
import sys
from importlib.metadata import metadata, PackageNotFoundError
+# Customize mypy cache dir via environment variable
+cache_dir = Path(__file__).parent.parent / ".mypy_cache"
+os.environ["MYPY_CACHE_DIR"] = str(cache_dir)
DEPS = ['flake8', 'lief', 'mypy', 'pyzmq']
-MYPY_CACHE_DIR = f"{os.getenv('BASE_ROOT_DIR', '')}/test/.mypy_cache"
# All .py files, except those in src/ (to exclude subtrees there)
FLAKE_FILES_ARGS = ['git', 'ls-files', '*.py', ':!:src/*.py']