From 4698910787c58499c629cb2835673a0cee2ae4be Mon Sep 17 00:00:00 2001 From: Tobias Mueller Date: Wed, 12 Apr 2023 13:42:28 +0200 Subject: [PATCH] pip: propagate error when downloading packages If pip fails to download, the generated sources file is empty and, arguably, useless. Instead of silently generating an empty file, the error is propagated now. The root cause appears to be a bug in pip. https://github.com/flatpak/flatpak-builder-tools/issues/265 --- pip/flatpak-pip-generator | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pip/flatpak-pip-generator b/pip/flatpak-pip-generator index 1b58d9de..673a4ec7 100755 --- a/pip/flatpak-pip-generator +++ b/pip/flatpak-pip-generator @@ -53,6 +53,8 @@ parser.add_argument('--runtime', help='Specify a flatpak to run pip inside of a sandbox, ensures python version compatibility') parser.add_argument('--yaml', action='store_true', help='Use YAML as output format instead of JSON') +parser.add_argument('--no-raise-on-error', action='store_true', + help='Ignore errors when downloading packages') opts = parser.parse_args() if opts.yaml: @@ -251,6 +253,9 @@ with tempfile.TemporaryDirectory(prefix=tempdir_prefix) as tempdir: except subprocess.CalledProcessError: print('Failed to download') print('Please fix the module manually in the generated file') + if not opts.no_raise_on_error: + print('Ignore the error by passing --no-raise-on-error') + raise if not opts.requirements_file: try: