Commit Graph

54 Commits

Author SHA1 Message Date
Miro Hrončok
f39261901c Add the -l/-L flag to %pyproject_save_files
- The -l flag can be used to assert at least 1 License-File was detected
- The -L flag explicitly disables this check (which remains the default)

Co-Authored-By: Maxwell G <maxwell@gtmx.me>
2023-12-11 13:16:09 +01:00
Karolina Surma
97a7574518 Add %_pyproject_check_import_allow_no_modules
Macro which allows to pass the import check even if no Python modules
are detected in the package.
Only to be used in the automated environments.

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2023-09-26 10:23:49 +00:00
590154b68c document config_settings support 2023-06-01 21:24:39 +02:00
Miro Hrončok
a5e7a3cd07 Deprecate the provisional %{pyproject_build_lib} macro
There is no scheduled removal.

See https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/HMLOPAU3RZLXD4BOJHTIPKI3I4U6U7OE/
2023-04-26 23:08:07 +02:00
Miro Hrončok
f21e684a67 Use %py3_test_envvars in %tox when available
The new %py3_test_envvars macro was added
to remove duplication of environment variables used in %check.

We reuse it in %tox to gain support e.g. for PYTEST_XDIST_AUTO_NUM_WORKERS.

However, we keep support for platforms where the macro is not yet available,
not to be forced to backport %py3_test_envvars everywhere right away.

Technically, this should change little, but it sets CFLAGS and LDFLAGS now,
hence a new Y version.
2022-12-15 19:52:09 +01: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
a3e31cca28 Docs: Remove one more forgotten %pyproject_buildrequires -r example 2022-09-12 22:34:49 +02:00
Miro Hrončok
66558cf4d1 Docs: Only mention -r for good measure, but don't mention it elsewhere
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2123167
2022-09-01 09:56:28 +02:00
Karolina Surma
bc3755d9e4 Fix typo in License-File
PEP 639 defines License-File field.
2022-08-03 13:22:01 +02:00
Benjamin A. Beasley
1996e90259 %pyproject_build_lib: support setuptools 62.1.0 and later 2022-06-16 08:00:09 -04:00
Miro Hrončok
e31d5d5683 CI and docs: Remove Fedora 34 conditionals and mentions
Fedora 34 is end of life.
2022-06-06 05:51:34 +00:00
Miro Hrončok
b8063c003e Markdown: Make the [prepare-metadata-for-build-wheel hook] link work in Pagure
(It works as it in on GitLab.)
2022-05-06 12:46:08 +02:00
Miro Hrončok
40f6765e0e Allow building wheels in %pyproject_buildrequires to support other build backends
The hook is optional, see https://www.python.org/dev/peps/pep-0517/#prepare-metadata-for-build-wheel

> If a build frontend needs this information and the method is not defined,
> it should call build_wheel and look at the resulting metadata directly.

This is not yet automatically detected because the feature is provisional.
Use `%pyproject_buildrequires -w` to opt-in.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2076994
2022-04-29 12:42:37 +02:00
Miro Hrončok
94d7dd2955 Release version 1.0.0, first release candidate 2022-01-25 17:07:24 +01:00
Miro Hrončok
8c8afba774 %pyproject_buildrequires: Make -r (include runtime) the default, use -R to opt-out
See the proposal:
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/2R6NKELTHAWE6PI3CCZBVW5PMGO5VPDG/

 - -N now implies -R
 - the macro still guards against -Nr and now also against -Rr
2022-01-18 17:50:00 +01:00
Hunor Csomortáni
832e19f5ab
docs: Don't BuildRequire these macros in Fedora and EPEL 9
`python3-devel` already requires `pyproject-rpm-macros` in Fedora and
EPEL 9. Update the usage docs to reflect this.

Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
2022-01-13 16:29:05 +01:00
Miro Hrončok
55905e4681 Define provisional %pyproject_build_lib 2021-12-10 12:40:50 +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
5729f18ddb Fix a typo in README 2021-07-23 10:01:13 +02:00
Miro Hrončok
f8a3343abc %pyproject_buildrequires now fails when it encounters an invalid requirement
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1983053
2021-07-23 10:00:01 +02:00
Tomas Hrnciar
d6ad9a778a Generate BuildRequires from file
%pyproject_buildrequires macro now accepts multiple file names to load
additional dependencies from them.

New option -N was added to disable automatical generation of requirements
in case package does not use build system. Option -N cannot be used in
combination with options -r, -e, -t, -x.

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2021-07-08 13:08:04 +02:00
Miro Hrončok
29157c19b0 Set %_pyproject_wheeldir and %_pyproject_builddir relative to the source tree, not $PWD
This allows users to do:

    %build
    cd somewhere
    %pyproject_wheel
    cd -
    cd somewhere_else
    %pyproject_wheel
    cd -

    %install
    %pyproject_install

Without a need to copy paste the wheels to a common location.

This is in fact a breaking change, I'll make sure to adapt the affected packages in Fedora.
2021-05-27 21:28:01 +02:00
Miro Hrončok
c0c09a476a Cleanup the tests (and docs) for Fedora 32 EOL 2021-05-27 21:27:39 +02:00
Miro Hrončok
7e1a8fd079 Handle tox provision (tox.requires / tox.minversion) 2021-04-07 16:01:33 +02: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
Petr Viktorin
6a44fe2d7a Fix name of option that redefines %{toxenv} 2020-10-08 17:55:43 +02:00
Petr Viktorin
d719a00b93 Document %pyproject_extras_subpkg 2020-10-02 20:57:26 +00:00
Miro Hrončok
ea43eebba6 Document %pyproject_buildrequires -x a -x b 2020-10-01 19:25:55 +02:00
Tomas Hrnciar
da3d9bc23d Automatically mark language files with %lang macro 2020-09-04 10:39:52 +02:00
Petr Viktorin
91acc88e2d Make %{_pyproject_wheeldir} an implementation detail 2020-08-20 12:02:34 +02:00
Petr Viktorin
fb4066b150 Update README
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1868346

- Explain what "provisional" means
- Say what kinds of projects the macros handle
- Tell people to BuidRequire python*-devel
- Say %pyproject_buildrequires is needed for the other macros
- Note that %pyproject_buildrequires generates `exit 11` messages
- Note that most buildsystems have prepare-metadata-for-build-wheel
2020-08-20 12:00:28 +02:00
Petr Viktorin
09be4c117d Typo fix 2020-08-20 11:48:14 +02:00
Miro Hrončok
6a8d86ed70 Allow multiple, comma-separated extras in %pyproject_buildrequires -x 2020-08-11 15:54:42 +02:00
Miro Hrončok
99d9596d7c Make sure to put * in '' in %pyproject_save_files
Otherwise, it may be expanded by Shell in random cases.
2020-08-06 20:19:40 +02:00
Tomas Hrnciar
5809bbc77e Replace +bindir with +auto in README and spec files 2020-08-06 15:26:37 +02:00
Miro Hrončok
262f6d3bc3 %pyproject_buildrequires -x now implies -r
The usage without -r errored anyway, this way instead of forcing the user to add it,
we do it ourselves.

Machines stealing human's labor, yet again.
2020-07-16 13:38:50 +02:00
Miro Hrončok
a723865460 Remove Fedora 30 remnants 2020-06-23 11:09:03 +00:00
Petr Viktorin
82a7579530 Document how to test the macros 2020-06-23 11:48:59 +02:00
Miro Hrončok
95ba8376f5 Handle extracting debuginfo from extension modules
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1806625

Upstream issue for a proper fix https://github.com/pypa/pip/issues/7555

Co-Authored-By: Petr Viktorin <pviktori@redhat.com>
2020-04-16 15:45:48 +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
Miro Hrončok
9bb7de7385 Fedora CI: Update the mock config to support mock 2.0
See https://github.com/rpm-software-management/mock/wiki/Release-Notes-2.0
2020-02-12 15:29:11 +01:00
Miro Hrončok
dbb90f5dc1 Preserve existing flags in shebangs of Python files in /usr/bin
Use pathfix.py with -k and -a flags

Solves problems like https://bugzilla.redhat.com/show_bug.cgi?id=1335203
2020-02-07 18:35:06 +01:00
Patrik Kopkan
49a323e46e create directory in $PWD for built wheel
It is little bit more explicit than installing wheels from $PWD.
2019-11-21 13:12:18 +01:00
Miro Hrončok
11da7b793a Documentation typo 2019-08-27 14:54:28 +02:00
Miro Hrončok
fda0a23075 -t means "use tox", -e means "use this toxenv", -e implies -t
Further fixes
2019-08-13 14:42:21 +02:00
Miro Hrončok
ec073171f3 Add %tox macro to invoke tests 2019-07-29 14:42:53 +02:00
Miro Hrončok
8a60635881 Allow to fetch test dependencies from tox 2019-07-26 15:07:11 +02:00
Petr Viktorin
03316d81e7 Document run-time deps 2019-07-18 11:24:18 +02:00
Petr Viktorin
50645e10a3 Refactor and add tests 2019-07-17 15:57:02 +02:00