On 04. 09. 22 14:15, Sandro wrote:
Hi,

Hi.

I'm tinkering with a package in review, trying to understand the Python RPM build process. The package is hatch-fancy-pypi-readme [1].

The package uses hatch for build, but it includes a non-license file, AUTHORS.md, which I thought would be trivial to patch around, so it's not included in the RPM.

I don't understand why do you want to do this in the first place. What is the issue with the file?

I patched the pyproject.toml and added:

[tool.hatch.build]
exclude = ["AUTHORS.md"]

I don't know hatch, so I cannot tell whether this does something useful.
Note that upstream has committed https://github.com/hynek/hatch-fancy-pypi-readme/commit/3b17e39c which might solve this (or not, not sure).

Then I realized %pyproject_buildrequires has the option -w enabled, producing a wheel for metadata extraction. So, I added a patch, putting a MANIFEST.in in the root dir of the project with one line:

exclude AUTHORS.md

The MANIFEST.in file does not say which files will be installed. It is used by distutils and/or setuptools to determine which files will be in the source tarball. I am not entirely sure if hatch reads that file at all.

Yet the whl archive still contains the file:

hatch_fancy_pypi_readme-22.3.0.dist-info/licenses/AUTHORS.md

and so does the final RPM.

Do I have to resort to manually removing the file in %prep?

If you insist on removing that file, deleting it in %prep sounds like much easier option than patching pyproject.toml. However, I'd keep it.

I encountered another issue with %pyproject_buildrequires when passing the -t option for automatic test requirements.

I wanted to see if I can get rid of the extra BuildRequires in the submitters spec file [2], so I commented out all but python3-dev and python3-test BuildRequires and added -t to %pyproject_buildrequires.

That made the build fail with:

No matching package to install: 'python3dist(pytest-icdiff)'

Yet, I don't see any test or other python module importing icdiff. Building with the original spec file, tests are run and succeed.

Is that a known issue with the -t option? Or am I missing something?

The pytest-icdiff dependency is listed by upstream as their test dependency for tox (-t stands for tox):

https://github.com/hynek/hatch-fancy-pypi-readme/blob/22.3.0/tox.ini#L49 ->
https://github.com/hynek/hatch-fancy-pypi-readme/blob/22.3.0/pyproject.toml#L50

The -t option reads that and generates the BuildRequires. If it is not needed, I suggest talking to upstream about why is this listed. In the meantime, you have 2 options to avoid the unwanted dependency:

 - don't use -t and list test dependencies manually instead
 - patch/sed it out from pyproject.toml

[1] https://github.com/hynek/hatch-fancy-pypi-readme
[2] https://pnemade.fedorapeople.org/python-hatch-fancy-pypi-readme.spec
--
Miro Hrončok
--
Phone: +420777974800
IRC: 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