File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1588,6 +1588,13 @@ def mypy_options(stubgen_options: Options) -> MypyOptions:
1588
1588
options .python_version = stubgen_options .pyversion
1589
1589
options .show_traceback = True
1590
1590
options .transform_source = remove_misplaced_type_comments
1591
+
1592
+ # Override cache_dir if provided in the environment
1593
+ environ_cache_dir = os .getenv ("MYPY_CACHE_DIR" , "" )
1594
+ if environ_cache_dir .strip ():
1595
+ options .cache_dir = environ_cache_dir
1596
+ options .cache_dir = os .path .expanduser (options .cache_dir )
1597
+
1591
1598
return options
1592
1599
1593
1600
@@ -1751,6 +1758,9 @@ def generate_stubs(options: Options) -> None:
1751
1758
manual changes. This directory is assumed to exist.
1752
1759
"""
1753
1760
1761
+ FOOTER : Final = """Environment variables:
1762
+ Define MYPY_CACHE_DIR to override configuration cache_dir path."""
1763
+
1754
1764
1755
1765
def parse_options (args : list [str ]) -> Options :
1756
1766
parser = argparse .ArgumentParser (prog = "stubgen" , usage = HEADER , description = DESCRIPTION )
You can’t perform that action at this time.
0 commit comments