@@ -23,6 +23,7 @@ class Options:
23
23
self .pyversion = 3
24
24
self .custom_typing_module = None # type: str
25
25
self .html_report_dir = None # type: str
26
+ self .python_path = False
26
27
27
28
28
29
def main () -> None :
@@ -73,7 +74,8 @@ def type_check_only(path: str, module: str, bin_dir: str, options: Options) -> N
73
74
pyversion = options .pyversion ,
74
75
custom_typing_module = options .custom_typing_module ,
75
76
html_report_dir = options .html_report_dir ,
76
- flags = options .build_flags )
77
+ flags = options .build_flags ,
78
+ python_path = options .python_path )
77
79
78
80
79
81
def process_options (args : List [str ]) -> Tuple [str , str , Options ]:
@@ -112,6 +114,9 @@ def process_options(args: List[str]) -> Tuple[str, str, Options]:
112
114
options .html_report_dir = args [1 ]
113
115
options .build_flags .append ('html-report' )
114
116
args = args [2 :]
117
+ elif args [0 ] == '--python-path' :
118
+ options .python_path = True
119
+ args = args [1 :]
115
120
else :
116
121
usage ('Unknown option: {}' .format (args [0 ]))
117
122
@@ -124,6 +129,10 @@ def process_options(args: List[str]) -> Tuple[str, str, Options]:
124
129
if args [1 :]:
125
130
usage ('Extra argument: {}' .format (args [1 ]))
126
131
132
+ if options .python_path and options .pyversion == 2 :
133
+ usage ('--py2 specified, '
134
+ 'but --python_path will search in sys.path of Python 3' )
135
+
127
136
return args [0 ], None , options
128
137
129
138
@@ -143,6 +152,7 @@ Optional arguments:
143
152
--html-report dir generate a HTML report of type precision under dir/
144
153
-m mod type check module
145
154
--verbose more verbose messages
155
+ --python_path search for modules in sys.path of running Python
146
156
147
157
Environment variables:
148
158
MYPYPATH additional module search path
0 commit comments