Bug 1900858 - Add virtual provides for installed Python modules
Summary: Add virtual provides for installed Python modules
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: fontforge
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
Assignee: Parag Nemade
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-11-23 20:48 UTC by Ben Beasley
Modified: 2020-11-28 04:19 UTC (History)
4 users (show)

Fixed In Version: fontforge-20200314-10.fc34
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-28 03:53:28 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Script to look for similar cases (slowly) (2.56 KB, text/x-python)
2020-11-27 15:27 UTC, Ben Beasley
no flags Details
Possible similar cases on Fedora 33 (104.50 KB, text/plain)
2020-11-27 15:28 UTC, Ben Beasley
no flags Details

Description Ben Beasley 2020-11-23 20:48:59 UTC
Description of problem:

The RPM package for fontforge, which installs the “fontforge” and “psMat” Python modules, should provide python3-fontforge, python3-psMat, and so on. This will make it easier for end-users and for packagers with Python-based fontforge dependencies, and will comply with the Fedora packaging guidelines: https://docs.fedoraproject.org/pt_BR/packaging-guidelines/Python/#_provides

Note that this will not provide python3dist(fontforge) or similar, as the modules are not distributed on PyPI and there is no .dist-info/.egg-info; see https://docs.fedoraproject.org/pt_BR/packaging-guidelines/Python/#_automatic_provides_with_a_standardized_name for details.

Version-Release number of selected component (if applicable):

20200314-9, and all previous versions and releases

How reproducible:


Steps to Reproduce:
1. With fontforge RPM installed: rpm -q --provides fontforge
2. Observe that no Python provides are present.
3. dnf install python3-{fontforge,psMat}
4. Observe that nothing provides these.

Actual results:

[user@host ~]$ rpm -q --provides fontforge
application()
application(org.fontforge.FontForge.desktop)
fontforge = 20200314-9.fc33
fontforge(x86-64) = 20200314-9.fc33
libfontforge.so.4()(64bit)
metainfo()
metainfo(org.fontforge.FontForge.appdata.xml)
mimehandler(application/font-woff)
mimehandler(application/vnd.font-fontforge-sfd)
mimehandler(application/x-font-bdf)
mimehandler(application/x-font-otf)
mimehandler(application/x-font-pcf)
mimehandler(application/x-font-tex)
mimehandler(application/x-font-ttf)
mimehandler(application/x-font-type1)
mimehandler(font/otf)
mimehandler(font/ttf)
mimehandler(font/woff)
mimehandler(font/woff2)

[user@host ~]$ sudo dnf install python3-{fontforge,psMat}
No match for argument: python3-fontforge
No match for argument: python3-psMat

Expected results:

[user@host ~]$ rpm -q --provides fontforge
application()
application(org.fontforge.FontForge.desktop)
fontforge = 20200314-10.fc33
fontforge(x86-64) = 20200314-10.fc33
libfontforge.so.4()(64bit)
metainfo()
metainfo(org.fontforge.FontForge.appdata.xml)
mimehandler(application/font-woff)
mimehandler(application/vnd.font-fontforge-sfd)
mimehandler(application/x-font-bdf)
mimehandler(application/x-font-otf)
mimehandler(application/x-font-pcf)
mimehandler(application/x-font-tex)
mimehandler(application/x-font-ttf)
mimehandler(application/x-font-type1)
mimehandler(font/otf)
mimehandler(font/ttf)
mimehandler(font/woff)
mimehandler(font/woff2)
python-fontforge = 20200314-10.fc33
python-psMat = 20200314-10.fc33
python3-fontforge = 20200314-10.fc33
python3-psMat = 20200314-10.fc33
python3.9-fontforge = 20200314-10.fc33
python3.9-psMat = 20200314-10.fc33

[user@host ~]$ sudo dnf install python3-{fontforge,psMat}
Package fontforge-20200314-10.fc33.x86_64 is already installed.
Package fontforge-20200314-10.fc33.x86_64 is already installed.

Additional info:

I have prepared a PR that adds the necessary macros: https://src.fedoraproject.org/rpms/fontforge/pull-request/7

Comment 1 Parag Nemade 2020-11-25 06:19:09 UTC
I got curious to know what other packages you found that can use these virtual provides in Fedora?

Comment 2 Ben Beasley 2020-11-27 15:26:59 UTC
That’s an interesting question. I only stumbled on this detail for fontforge while studying dependencies for gftools (Google Fonts Tools).

In response to your question, I wrote a script, to be attached as possible-missing-py_provides.py, to look for packages that might be in a similar situation. It takes a long time to run, but I was not in a hurry.

The result is to be attached as possible-missing-py_provides.txt.

Importantly, this list is just based on a heuristic and probably has quite a lot of false positives. For example, some of these Python modules or packages might be designed only to support a particular application. While the Fedora guidelines do not call out this case as an exception, it doesn’t seem useful to worry about cases where the Python module or package does not provide a public API, i.e., is not designed to be imported by code outside the application. For example, yamllint provides a Python package of the same name, but https://yamllint.readthedocs.io/en/stable/quickstart.html does not advertise a Python API. Manual review of documentation is required to identify such cases.

A lot of cases in this list are those where the module name on PyPI is not the same as the imported module, which is a case the guidelines specifically talk about:

> For any module foo intended to be used in Python 3 with import foo, the package that includes it should provide python3-foo. This is of course always the case if the subpackage is named python3-foo (as in the examples below). If the subpackage has some other name, then Provides: python3-foo should be added explicitly (via %py_provides python3-foo, see below).

For example, python3-sphinx-notfound-page provides a Python package of the same name (sphinx-notfound-page on PyPI), and python3dist(sphinx-notfound-page) and so on, but the package that is imported is simply named notfound, so by my reading of the guidelines it should have %py_provides python3-notfound.

Comment 3 Ben Beasley 2020-11-27 15:27:54 UTC
Created attachment 1734153 [details]
Script to look for similar cases (slowly)

Comment 4 Ben Beasley 2020-11-27 15:28:27 UTC
Created attachment 1734154 [details]
Possible similar cases on Fedora 33

Comment 5 Parag Nemade 2020-11-28 03:53:28 UTC
Okay so you just wanted this package to add virtual provides.

I have been knowing this missing virtual provides for sometime for this package. I was just waiting for someone to complain it.
I could not find a single package in Fedora yet that needs python3-psMat or python3-fontforge as a dependency package.

Anyways thanks for this bug :)

Comment 6 Ben Beasley 2020-11-28 04:00:29 UTC
Ah, you were just asking about fontforge! That’s a much easier question. At least as of F33, it looks like mftrace is the only package with a fontforge dependency, and it does use the CLI. I think gftools (when I get all the other dependencies lined up) will therefore be the first to use the fontforge Python module.

Comment 7 Parag Nemade 2020-11-28 04:19:46 UTC
Ah you are right. Sorry I confused you.

I found that I was wrongly looking into RHEL8 repository query only but in Fedora you are right mftrace requires: fontforge package.

One more reason I needed that information is to think in future if I can split fontforge into python3-fontforge subpackage actually.

Thank you.


Note You need to log in before you can comment on or make changes to this bug.