From 41d38d027dee5a2ab0c020cb09c486b1428fab19 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..ae81b0c2 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('--ignore-errors', 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.ignore_errors: + print('Ignore the error by passing --no-raise-on-error') + raise if not opts.requirements_file: try: