Write %__default_python3_version value from spec

This commit is contained in:
Maxwell G 2022-06-25 22:54:25 -05:00
parent 66a9033eb4
commit aa8dffeb8e
No known key found for this signature in database
GPG Key ID: F79E4E25E8C661F8
2 changed files with 8 additions and 13 deletions

View File

@ -17,7 +17,7 @@
# There are two macros:
#
# This always contains the major.minor version (with dots), default for %%python3_version.
%__default_python3_version 3.11
%__default_python3_version @@__DEFAULT_PYTHON3_VERSION@@
#
# The pkgname version that determines the alternative provide name (e.g. python3.9-foo),
# set to the same as above, but historically hasn't included the dot.

View File

@ -37,17 +37,7 @@ Source403: brp-fix-pyc-reproducibility
# brp scripts: GPLv2+
License: MIT and Python and GPLv2+
# The package version MUST be always the same as %%{__default_python3_version}.
# To have only one source of truth, we load the macro and use it.
# The macro is defined in python-srpm-macros.
%{lua:
if posix.stat(rpm.expand('%{SOURCE102}')) then
rpm.load(rpm.expand('%{SOURCE102}'))
elseif posix.stat('macros.python-srpm') then
-- something is parsing the spec without _sourcedir macro properly set
rpm.load('macros.python-srpm')
end
}
%global __default_python3_version 3.11
Version: %{__default_python3_version}
Release: 2%{?dist}
@ -102,6 +92,9 @@ RPM macros for building Python 3 packages.
%prep
%autosetup -c -T
cp -a %{sources} .
# Write definition of %%__default_python3_version from specfile into
# macros.python-srpm.
%writevars -f macros.python-srpm __default_python3_version
%install
@ -153,7 +146,9 @@ grep -E '^#[^%%]*%%[^%%]' %{buildroot}%{rpmmacrodir}/macros.* && exit 1 || true
%changelog
* Sun Jun 26 2022 Maxwell G <gotmax@e.email> - 3.11-2
- Define %%forgesetupargs in %%pypi_source so users can call %%forgeautosetup
or %%forgesetup and not have to define extra vars or pass -n to %setup.
or %%forgesetup and not have to define extra macros or pass -n to %setup.
- Write definition of %__default_python3_version from spec instead of
loading macros.python-srpm.
* Mon Jun 13 2022 Tomáš Hrnčiar <thrnciar@redhat.com> - 3.11-1
- Update main Python to Python 3.11