Skip to content

Commit

Permalink
pip: propagate error when downloading packages
Browse files Browse the repository at this point in the history
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.

#265
  • Loading branch information
muelli committed Apr 25, 2023
1 parent de81f43 commit 41d38d0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pip/flatpak-pip-generator
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 41d38d0

Please sign in to comment.