File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -1575,6 +1575,13 @@ def mypy_options(stubgen_options: Options) -> MypyOptions:
1575
1575
options .python_version = stubgen_options .pyversion
1576
1576
options .show_traceback = True
1577
1577
options .transform_source = remove_misplaced_type_comments
1578
+
1579
+ # Override cache_dir if provided in the environment
1580
+ environ_cache_dir = os .getenv ("MYPY_CACHE_DIR" , "" )
1581
+ if environ_cache_dir .strip ():
1582
+ options .cache_dir = environ_cache_dir
1583
+ options .cache_dir = os .path .expanduser (options .cache_dir )
1584
+
1578
1585
return options
1579
1586
1580
1587
@@ -1735,6 +1742,8 @@ def generate_stubs(options: Options) -> None:
1735
1742
manual changes. This directory is assumed to exist.
1736
1743
"""
1737
1744
1745
+ FOOTER : Final = """Environment variables:
1746
+ Define MYPY_CACHE_DIR to override configuration cache_dir path."""
1738
1747
1739
1748
def parse_options (args : list [str ]) -> Options :
1740
1749
parser = argparse .ArgumentParser (prog = "stubgen" , usage = HEADER , description = DESCRIPTION )
You can’t perform that action at this time.
0 commit comments