File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
python/private/pypi/dependency_resolver Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ Unreleased changes template.
102102* (packaging) An empty ` requires_file ` is treated as if it were omitted, resulting in a valid ` METADATA ` file.
103103* (rules) py_wheel and sphinxdocs rules now propagate ` target_compatible_with ` to all targets they create.
104104 [ PR #2788 ] ( https://github.com/bazel-contrib/rules_python/pull/2788 ) .
105+ * (pypi) Dependency resolution failures no longer show the full exception traceback in the output
105106
106107{#v0-0-0-added}
107108### Added
Original file line number Diff line number Diff line change 2424
2525import click
2626import piptools .writer as piptools_writer
27+ from pip ._internal .exceptions import DistributionNotFound
28+ from pip ._vendor .resolvelib .resolvers import ResolutionImpossible
2729from piptools .scripts .compile import cli
2830
2931from python .runfiles import runfiles
@@ -201,6 +203,7 @@ def main(
201203 requirements_file_relative_path .write_text (content )
202204 else :
203205 print ("Checking " + requirements_file )
206+ sys .stdout .flush ()
204207 _run_pip_compile ()
205208 golden = open (_locate (bazel_runfiles , requirements_file )).readlines ()
206209 out = open (requirements_out ).readlines ()
@@ -223,6 +226,14 @@ def run_pip_compile(
223226) -> None :
224227 try :
225228 cli (args , standalone_mode = False )
229+ except DistributionNotFound as e :
230+ if isinstance (e .__cause__ , ResolutionImpossible ):
231+ # pip logs an informative error to stderr already
232+ # just render the error and exit
233+ print (e )
234+ sys .exit (1 )
235+ else :
236+ raise
226237 except SystemExit as e :
227238 if e .code == 0 :
228239 return # shouldn't happen, but just in case
You can’t perform that action at this time.
0 commit comments