FS#73242 - [python] optdepend on mailcap pkg
Attached to Project:
Arch Linux
Opened by Csaba Henk (csheemea) - Monday, 03 January 2022, 15:45 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:14 GMT
Opened by Csaba Henk (csheemea) - Monday, 03 January 2022, 15:45 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:14 GMT
|
Details
Description:
For python mimetypes module relies on the /etc/mime.types file, provided by mailcap (or actual mime-types provider). The dependency is implicit: mimetypes does not present an error condition on lack of /etc/mime.types, rather provides a stub. However, this results in unreliable deployment for a program that utilizes the mimetypes module. While this is basically a flaw of the Python ecosystem, Arch can mitigate the issue by adding the optional dependency. Additional info: * package version(s): seen with python 3.10.1-2 Steps to reproduce: $ pacman -Q mailcap error: package 'mailcap' was not found $ python -c 'import sys,mimetypes; print(mimetypes.guess_type(sys.argv[1]))' foo.mkv (None, None) ... $ pacman -Q mailcap mailcap 2.1.53-1 $ python -c 'import sys,mimetypes; print(mimetypes.guess_type(sys.argv[1]))' foo.mkv ('video/x-matroska', None) |
This task depends upon
Closed by Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:14 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/python/issues/1
Saturday, 25 November 2023, 20:14 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/python/issues/1
Let's not add an optdependency for something which will be deprecated soon.
I was talking about the mimetypes module which you also mention as a preferred interface to mime types.
My statement is that the mimetypes module is defunct without the mailcap system package (which delivers /etc/mime.types, on which the mimetypes module relies).
To worsen things, the disfunctionality of the mimetypes module is shadowed as its API still gives back a stub value in lack of /etc/mime.types. This might lead to unexcpected behavior for programs that use the mimetypes module.
THis is demonstrated in the oneliner I provided. The behavior is still the same with current python 3.11.5-2.