Commit Graph

20 Commits

Author SHA1 Message Date
Lumir Balhar
7ba21ea4a8 Improve detection of lang files 2023-02-09 11:01:23 +00:00
Karolina Surma
516e1511a7 Filter discovered modules to match the given %pyproject_save_files globs
When certain modules are deliberately not included into the built RPM,
they shouldn't be listed in the list of qualified module names which are
used by %pyproject_check_import to test importability of the
distribution.
Resolves: https://bugzilla.redhat.com/2127958
2022-10-03 13:22:48 +02:00
Miro Hrončok
92ad52e5d4 %pyproject_save_files: Support License-Files installed into the *Root License Directory* from PEP 369
Files still need to be marked as License-File to be considered %license,
but if their path in METADATA is specified relative to dist-info/licenses,
they are correctly recognised.

This makes License-Files specified by hatchling 1.9.0+ marked as %license.
2022-09-19 18:22:03 +02:00
Karolina Surma
fa49bf2efb Don't fail %pyproject_save_files '*' if no modules are present
Users invoking %pyproject_save_files with glob: '*' don't care about the
files in the Python package, hence it shouldn't error when no modules
are detected.
There may be legitimate reasons to create a package without Python
modules in it, hence we shouldn't be blocking this possibility.
2022-08-09 11:11:06 +02:00
Miro Hrončok
6d0900f5b5 %pyproject_save_files: Support nested directories in dist-info 2022-04-27 10:34:03 +02:00
Karolina Surma
c3a20e9a33 Include compressed manpages correctly in the RPM package
Compressed manpages have different extension than those listed in the RECORD file,
so they were not recognized when %%pyproject_save_files '+auto' flag
was provided.
To enable the path recognition, if the manpage extension matches the one
listed in brp-compres, the extension is removed, and an asterisk is now added
to the manpages filenames.
Source: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_manpages
Fixes: https://bugzilla.redhat.com/2033254
2022-01-20 19:57:47 +01:00
Karolina Surma
c1baa534b6 Introduce %%pyproject_check_import
%%pyproject_save_files newly saves also a list of importable modules.
The list is used by %%pyproject_check_import to invoke the import test
on each module name.
%%pyproject_check_import accepts two options:
-t: filter only top-level modules
-e: exclude module names matching the given glob from the import check
2021-10-29 08:40:42 +02:00
Tomas Hrnciar
5169e0e340 Automatically detect LICENSE files and mark them with %license macro 2021-07-23 13:30:43 +02:00
Miro Hrončok
cc5688e49d Include nested __pycache__ directories in %pyproject_save_files 2021-02-07 20:05:47 +01:00
Miro Hrončok
d8b6408932 %pyproject_save_files: List all files from RECORD and their %dirs
This is done to avoid troubles with %lang files listed as duplicated.

 1. It gets rid of a warning
 2. It fixes a problem described in:
    http://lists.rpm.org/pipermail/rpm-list/2020-November/002041.html

This is a backwards incompatible change,
packages that rename or remove the installed files after %pyproject_install
might no longer be compatible with %pyproject_save_files.
2021-01-11 15:14:21 +01:00
Lumir Balhar
efdfb4727f Automatically remove dist-info/REQUESTED files together with RECORD 2020-10-01 09:28:21 +02:00
Lumir Balhar
a5cf74fc41 [TESTS] dist-info/RECORD file is no longer present in RPMs
%pyproject_install deletes it after conversion to pyproject-record
2020-09-25 12:24:50 +00:00
Miro Hrončok
c1d5d64f8c Prevent "File listed twice" warning with %lang files outside of Python modules 2020-09-07 09:42:33 +00:00
Tomas Hrnciar
d754bc75b9 Test for package with lang files located outside of module 2020-09-04 10:39:52 +02:00
Tomas Hrnciar
da3d9bc23d Automatically mark language files with %lang macro 2020-09-04 10:39:52 +02:00
Tomas Hrnciar
d0d4060cec Add test for +auto argument to include .pth files in other files 2020-08-06 15:26:37 +02:00
Tomas Hrnciar
0db4e67f03 Add test for +auto argument to include data files in other files 2020-08-06 15:26:37 +02:00
Tomas Hrnciar
91c8c27c63 Remove unused "executables" section from script and test data 2020-08-06 15:26:37 +02:00
Tomas Hrnciar
e2c64e79a0 Modify tests to accept all unclassified files in others. 2020-08-06 15:26:37 +02:00
Patrik Kopkan
2800b49530 Add %pyproject_save_files macro
This macro save generates file section to %pyproject_files. It should
simplify %files section and allow to build by some automatic machinery

Supposed use case in Fedora:
    %install
    %pyproject_install
    %pyproject_save_files requests _requests

    %files -n python3-requests -f %{pyproject_files}
    %doc README.rst
    %license LICENSE

Automatic build of arbitrary packages (e.g. in Copr):
    %install
    %pyproject_install
    %pyproject_save_files * +bindir // save all modules with executables

    %files -n python3-requests -f %{pyproject_files}

Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
2020-04-15 16:45:10 +02:00