macports / upt-macports

The Universal Packaging Tool (upt) backend for MacPorts
https://framagit.org/upt/upt
BSD 3-Clause "New" or "Revised" License
8 stars 12 forks source link

Do not crash when no archives could be found. #71

Closed Steap closed 3 years ago

Steap commented 3 years ago

Close: #70

reneeotten commented 3 years ago

@catap that already happens now with some logging, but perhaps we should update the message a bit:

[ERROR   ] [Backend] Could not determine the type of the source archive

@Steap thanks for the fix here and the PR with the update function! Instead of changing things in the template so that it doesn't crash in such an unfriendly way; I would probably prefer to just to exit when the archive couldn't be found - there is nothing we can do with upt or in MacPorts if that is the case.

So how about doing this in upt_macports.py instead:

            except upt.ArchiveUnavailable:
                self.logger.error('Could not determine the type of the source archive') # noqa
-               return 'unknown'
+               sys.exit(1)
catap commented 3 years ago

@reneeotten I dissagree with idea to exit. Let me explain. Right now utp just created a port without checksum and when it works with -r it continue to create dependencies ports. Am I wrong?

Steap commented 3 years ago

@reneeotten As @catap pointed out, when using "-r" for recursive packaging, it might be interesting not to exit.

upt can do a few things when the tarball cannot be found: for instance, the dependencies are computed from the wheel, and some of the metadata are computed from a JSON file served by PyPI. This does mean that the packager will need to find the tarball somewhere else (possibly on github, for instance).

It should be very rare that tarballs are not uploaded to PyPI, though.