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
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Felix Yan (felixonmars)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

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
Comment by Jelle van der Waa (jelly) - Saturday, 02 September 2023, 13:21 GMT
Deprecated since version 3.11, will be removed in version 3.13: The mailcap module is deprecated (see PEP 594 for details). The mimetypes module provides an alternative.


Let's not add an optdependency for something which will be deprecated soon.
Comment by Csaba Henk (csheemea) - Tuesday, 17 October 2023, 19:38 GMT
I acknowledge that python's mailcap module is deprecated; however, I was not talking about that module.

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.

Loading...