Hello Pythonistas.

I came across a couple packages that only install .dist-info in %python3_sitelib/arch, or an additional .pth file.

E.g. it's a Python-packaged command line tool that installs /usr/bin/foo + .dist-info only (e.g. badchars, ddiskit, fuzza, isrcsubmit, ksc, pwncat, python-vevents, urlbuster, snallygaster). Or it installs a .pth file + dist-info.only (e.g. python-coverage_pth).

Currently, there is only one way to use %pyproject_save_files with them:

  %pyproject_save_files '*'

THis works because a special case exists in %pyproject_save_files to support automated packaging e.g. in Copr. When the list of module globs contains '*', we assume no modules at all are OK. However, we do not allow '*' in official Fedora packages.

%pyproject_save_files currently requires at least one argument. So there is no way to call it with no globs. Currently, such packages need to manually list %{python3_sitelib}/xxx-%{version}.dist-info in %files. And they don't benefit from automatic %license discovery. I want to change that, but I want to consult the API ideas:

1. Allow %pyproject_save_files without arguments
================================================

  %pyproject_install
  %pyproject_save_files

Simple, easy. Calling %pyproject_save_files without arguments will work and it will only save the .dist-info for %{pyproject_files}. (This will allow to use the pyproject RPM declarative BuildSystem without BuildOption(install) as well.)

Are there any downsides? Even if packages forget to add arguments to %pyproject_save_files, this will work:

  %install
  %pyproject_install
  %pyproject_save_files

  %files -n python3-foo -f %{pyproject_files}
  %{python3_sitelib}/foo/

My only worry now is that the "default" behavior of %pyproject_save_files exists only to accommodate a very niche need.

2. Empty string argument
========================

  %pyproject_install
  %pyproject_save_files ''

Empty argument means no modules. I don't like this, it's hard to read, hard to explain.

3. Another +argument
====================

  %pyproject_install
  %pyproject_save_files +nomodules

We already have +auto, so this would be another +thing. I don't like this much, but more than 2.

4. Another short option
=======================

  %pyproject_install
  %pyproject_save_files -M

(The character choice is arbitrary.) We already have -l/-L. This would be another such option.

5. Do not require %pyproject_save_files in that case
====================================================

  %pyproject_install

This would populate %{pyproject_files} with the .dist-info only.
Subsequent %pyproject_save_files calls would override/expand it.

However, there are challenges: what happens if there are multiple wheels installed this way? etc.

-----

I'd probably go with option 1. But perhaps there's something else I have not figured out. Thoughts?

--
Miro Hrončok
--
Phone: +420777974800
Fedora Matrix: mhroncok

--
_______________________________________________
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to