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 @@ -1577,6 +1577,13 @@ def mypy_options(stubgen_options: Options) -> MypyOptions:
1577
1577
options .python_version = stubgen_options .pyversion
1578
1578
options .show_traceback = True
1579
1579
options .transform_source = remove_misplaced_type_comments
1580
+
1581
+ # Override cache_dir if provided in the environment
1582
+ environ_cache_dir = os .getenv ("MYPY_CACHE_DIR" , "" )
1583
+ if environ_cache_dir .strip ():
1584
+ options .cache_dir = environ_cache_dir
1585
+ options .cache_dir = os .path .expanduser (options .cache_dir )
1586
+
1580
1587
return options
1581
1588
1582
1589
@@ -1737,6 +1744,9 @@ def generate_stubs(options: Options) -> None:
1737
1744
manual changes. This directory is assumed to exist.
1738
1745
"""
1739
1746
1747
+ FOOTER : Final = """Environment variables:
1748
+ Define MYPY_CACHE_DIR to override configuration cache_dir path."""
1749
+
1740
1750
1741
1751
def parse_options (args : list [str ]) -> Options :
1742
1752
parser = argparse .ArgumentParser (prog = "stubgen" , usage = HEADER , description = DESCRIPTION )
You can’t perform that action at this time.
0 commit comments