File tree 1 file changed +11
-0
lines changed
python/private/pypi/dependency_resolver
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 24
24
25
25
import click
26
26
import piptools .writer as piptools_writer
27
+ from pip ._internal .exceptions import DistributionNotFound
28
+ from pip ._vendor .resolvelib .resolvers import ResolutionImpossible
27
29
from piptools .scripts .compile import cli
28
30
29
31
from python .runfiles import runfiles
@@ -203,6 +205,7 @@ def main(
203
205
requirements_file_relative_path .write_text (content )
204
206
else :
205
207
print ("Checking " + requirements_file )
208
+ sys .stdout .flush ()
206
209
_run_pip_compile ()
207
210
golden = open (_locate (bazel_runfiles , requirements_file )).readlines ()
208
211
out = open (requirements_out ).readlines ()
@@ -225,6 +228,14 @@ def run_pip_compile(
225
228
) -> None :
226
229
try :
227
230
cli (args , standalone_mode = False )
231
+ except DistributionNotFound as e :
232
+ if isinstance (e .__cause__ , ResolutionImpossible ):
233
+ # pip logs an informative error to stderr already
234
+ # just render the error and exit
235
+ print (e )
236
+ sys .exit (1 )
237
+ else :
238
+ raise
228
239
except SystemExit as e :
229
240
if e .code == 0 :
230
241
return # shouldn't happen, but just in case
You can’t perform that action at this time.
0 commit comments