Namespace pyproject-rpm-macros generated text files with %{python3_pkgversion}
This commit is contained in:
parent
188276960b
commit
29eb590e45
@ -1,5 +1,9 @@
|
|||||||
|
# This is a backward-compatible suffix used in all pyproject-rpm-macros directories
|
||||||
|
# For the main Python it's empty, for all others it's "-3.X"
|
||||||
|
%_pyproject_files_pkgversion %{expr:"%{python3_pkgversion}" != "3" ? "-%{python3_pkgversion}" : ""}
|
||||||
|
|
||||||
# This is a directory where wheels are stored and installed from, absolute
|
# This is a directory where wheels are stored and installed from, absolute
|
||||||
%_pyproject_wheeldir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/pyproject-wheeldir
|
%_pyproject_wheeldir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/pyproject-wheeldir%{_pyproject_files_pkgversion}
|
||||||
|
|
||||||
# This is a directory used as TMPDIR, where pip copies sources to and builds from, relative to PWD
|
# This is a directory used as TMPDIR, where pip copies sources to and builds from, relative to PWD
|
||||||
# For proper debugsource packages, we create TMPDIR within PWD
|
# For proper debugsource packages, we create TMPDIR within PWD
|
||||||
@ -8,12 +12,12 @@
|
|||||||
# This will be used in debugsource package paths (applies to extension modules only)
|
# This will be used in debugsource package paths (applies to extension modules only)
|
||||||
# NB: pytest collects tests from here if not hidden
|
# NB: pytest collects tests from here if not hidden
|
||||||
# https://docs.pytest.org/en/latest/reference.html#confval-norecursedirs
|
# https://docs.pytest.org/en/latest/reference.html#confval-norecursedirs
|
||||||
%_pyproject_builddir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.pyproject-builddir
|
%_pyproject_builddir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.pyproject-builddir%{_pyproject_files_pkgversion}
|
||||||
|
|
||||||
# We prefix all created files with this value to make them unique
|
# We prefix all created files with this value to make them unique
|
||||||
# Ideally, we would put them into %%{buildsubdir}, but that value changes during the spec
|
# Ideally, we would put them into %%{buildsubdir}, but that value changes during the spec
|
||||||
# The used value is similar to the one used to define the default %%buildroot
|
# The used value is similar to the one used to define the default %%buildroot
|
||||||
%_pyproject_files_prefix %{name}-%{version}-%{release}.%{_arch}
|
%_pyproject_files_prefix %{name}-%{version}-%{release}.%{_arch}%{_pyproject_files_pkgversion}
|
||||||
|
|
||||||
%pyproject_files %{_builddir}/%{_pyproject_files_prefix}-pyproject-files
|
%pyproject_files %{_builddir}/%{_pyproject_files_prefix}-pyproject-files
|
||||||
%_pyproject_modules %{_builddir}/%{_pyproject_files_prefix}-pyproject-modules
|
%_pyproject_modules %{_builddir}/%{_pyproject_files_prefix}-pyproject-modules
|
||||||
|
@ -13,7 +13,7 @@ License: MIT
|
|||||||
# Increment Y and reset Z when new macros or features are added
|
# Increment Y and reset Z when new macros or features are added
|
||||||
# Increment Z when this is a bugfix or a cosmetic change
|
# Increment Z when this is a bugfix or a cosmetic change
|
||||||
# Dropping support for EOL Fedoras is *not* considered a breaking change
|
# Dropping support for EOL Fedoras is *not* considered a breaking change
|
||||||
Version: 1.11.0
|
Version: 1.12.0
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
|
|
||||||
# Macro files
|
# Macro files
|
||||||
@ -183,6 +183,11 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jan 26 2024 Miro Hrončok <miro@hroncok.cz> - 1.12.0-1
|
||||||
|
- Namespace pyproject-rpm-macros generated text files with %%{python3_pkgversion}
|
||||||
|
- That way, a single-spec can be used to build packages for multiple Python versions
|
||||||
|
- Fixes: rhbz#2209055
|
||||||
|
|
||||||
* Wed Sep 27 2023 Miro Hrončok <mhroncok@redhat.com> - 1.11.0-1
|
* Wed Sep 27 2023 Miro Hrončok <mhroncok@redhat.com> - 1.11.0-1
|
||||||
- Add the -l/-L flag to %%pyproject_save_files
|
- 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 can be used to assert at least 1 License-File was detected
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/bash -eux
|
#!/usr/bin/bash -eux
|
||||||
|
if [ -z "${VERSION_ID-}" ] && [ -z "${NAME-}" ]; then
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
|
fi
|
||||||
|
|
||||||
version=$(echo "${VERSION_ID}" | cut -d. -f1)
|
version=$(echo "${VERSION_ID}" | cut -d. -f1)
|
||||||
arch="x86_64"
|
arch="x86_64"
|
||||||
|
@ -9,7 +9,6 @@ License: MIT
|
|||||||
URL: https://github.com/timothycrosley/%{modname}
|
URL: https://github.com/timothycrosley/%{modname}
|
||||||
Source0: %{url}/archive/%{version}-2/%{modname}-%{version}-2.tar.gz
|
Source0: %{url}/archive/%{version}-2/%{modname}-%{version}-2.tar.gz
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: python%{python3_pkgversion}-devel
|
|
||||||
BuildRequires: pyproject-rpm-macros
|
BuildRequires: pyproject-rpm-macros
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -18,7 +17,7 @@ Building this tests that executables are not listed when +auto is not used
|
|||||||
with %%pyproject_save_files.
|
with %%pyproject_save_files.
|
||||||
|
|
||||||
This package also uses %%{python3_pkgversion} in name and has a very limited
|
This package also uses %%{python3_pkgversion} in name and has a very limited
|
||||||
set of dependencies -- allows to set a different value for it in the CI.
|
set of dependencies -- allows to set a different value for it repeatedly.
|
||||||
|
|
||||||
%package -n python%{python3_pkgversion}-%{modname}
|
%package -n python%{python3_pkgversion}-%{modname}
|
||||||
Summary: %{summary}
|
Summary: %{summary}
|
||||||
@ -26,6 +25,24 @@ Summary: %{summary}
|
|||||||
%description -n python%{python3_pkgversion}-%{modname}
|
%description -n python%{python3_pkgversion}-%{modname}
|
||||||
%{summary}.
|
%{summary}.
|
||||||
|
|
||||||
|
%if 0%{?rhel} == 9
|
||||||
|
%global python3_pkgversion 3.11
|
||||||
|
%package -n python%{python3_pkgversion}-%{modname}
|
||||||
|
Summary: %{summary}
|
||||||
|
|
||||||
|
%description -n python%{python3_pkgversion}-%{modname}
|
||||||
|
%{summary}.
|
||||||
|
|
||||||
|
%global python3_pkgversion 3.12
|
||||||
|
%package -n python%{python3_pkgversion}-%{modname}
|
||||||
|
Summary: %{summary}
|
||||||
|
|
||||||
|
%description -n python%{python3_pkgversion}-%{modname}
|
||||||
|
%{summary}.
|
||||||
|
|
||||||
|
%global python3_pkgversion 3
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n %{modname}-%{version}-2
|
%autosetup -n %{modname}-%{version}-2
|
||||||
@ -33,13 +50,38 @@ Summary: %{summary}
|
|||||||
|
|
||||||
%generate_buildrequires
|
%generate_buildrequires
|
||||||
%pyproject_buildrequires
|
%pyproject_buildrequires
|
||||||
|
%if 0%{?rhel} == 9
|
||||||
|
%global python3_pkgversion 3.11
|
||||||
|
%pyproject_buildrequires
|
||||||
|
%global python3_pkgversion 3.12
|
||||||
|
%pyproject_buildrequires
|
||||||
|
%global python3_pkgversion 3
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%pyproject_wheel
|
%pyproject_wheel
|
||||||
|
%if 0%{?rhel} == 9
|
||||||
|
%global python3_pkgversion 3.11
|
||||||
|
%pyproject_wheel
|
||||||
|
%global python3_pkgversion 3.12
|
||||||
|
%pyproject_wheel
|
||||||
|
%global python3_pkgversion 3
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
|
%if 0%{?rhel} == 9
|
||||||
|
%global python3_pkgversion 3.11
|
||||||
|
%pyproject_install
|
||||||
|
%pyproject_save_files -l isort
|
||||||
|
%global python3_pkgversion 3.12
|
||||||
|
%pyproject_install
|
||||||
|
%pyproject_save_files -l isort
|
||||||
|
%global python3_pkgversion 3
|
||||||
|
%endif
|
||||||
|
# we keep this one last so /usr/bin/isort is installed with python3 shebang
|
||||||
%pyproject_install
|
%pyproject_install
|
||||||
%pyproject_save_files -l isort
|
%pyproject_save_files -l isort
|
||||||
|
|
||||||
@ -52,7 +94,32 @@ test -d %{buildroot}%{python3_sitelib}/%{modname}-%{version}.dist-info/
|
|||||||
# Internal check that executables are not present when +auto was not used with %%pyproject_save_files
|
# Internal check that executables are not present when +auto was not used with %%pyproject_save_files
|
||||||
grep -F %{_bindir}/%{modname} %{pyproject_files} && exit 1 || true
|
grep -F %{_bindir}/%{modname} %{pyproject_files} && exit 1 || true
|
||||||
|
|
||||||
|
%if 0%{?rhel} == 9
|
||||||
|
# Internal check that correct versions are in correct %%{pyproject_files}s
|
||||||
|
diff %{pyproject_files} <(grep -F python3.9/site-packages %{pyproject_files})
|
||||||
|
|
||||||
|
%global python3_pkgversion 3.11
|
||||||
|
test -d %{buildroot}%{_usr}/lib/python3.11/site-packages/%{modname}/
|
||||||
|
test -d %{buildroot}%{_usr}/lib/python3.11/site-packages/%{modname}-%{version}.dist-info/
|
||||||
|
diff %{pyproject_files} <(grep -F python3.11/site-packages %{pyproject_files})
|
||||||
|
|
||||||
|
%global python3_pkgversion 3.12
|
||||||
|
test -d %{buildroot}%{_usr}/lib/python3.12/site-packages/%{modname}/
|
||||||
|
test -d %{buildroot}%{_usr}/lib/python3.12/site-packages/%{modname}-%{version}.dist-info/
|
||||||
|
diff %{pyproject_files} <(grep -F python3.12/site-packages %{pyproject_files})
|
||||||
|
%global python3_pkgversion 3
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%files -n python%{python3_pkgversion}-%{modname} -f %{pyproject_files}
|
%files -n python%{python3_pkgversion}-%{modname} -f %{pyproject_files}
|
||||||
%doc README.rst *.md
|
%doc README.rst *.md
|
||||||
%{_bindir}/%{modname}
|
%{_bindir}/%{modname}
|
||||||
|
%if 0%{?rhel} == 9
|
||||||
|
%global python3_pkgversion 3.11
|
||||||
|
%files -n python%{python3_pkgversion}-%{modname} -f %{pyproject_files}
|
||||||
|
%doc README.rst *.md
|
||||||
|
%global python3_pkgversion 3.12
|
||||||
|
%files -n python%{python3_pkgversion}-%{modname} -f %{pyproject_files}
|
||||||
|
%doc README.rst *.md
|
||||||
|
%global python3_pkgversion 3
|
||||||
|
%endif
|
||||||
|
@ -110,9 +110,9 @@
|
|||||||
- config-settings-test:
|
- config-settings-test:
|
||||||
dir: .
|
dir: .
|
||||||
run: ./mocktest.sh config-settings-test
|
run: ./mocktest.sh config-settings-test
|
||||||
- isort_311:
|
- isort_c9s:
|
||||||
dir: .
|
dir: .
|
||||||
run: ./mocktest.sh python-isort --define 'python3_pkgversion 3.11'
|
run: NAME="CentOS Stream" VERSION_ID=9 ./mocktest.sh python-isort
|
||||||
- mistune_311:
|
- mistune_311:
|
||||||
dir: .
|
dir: .
|
||||||
run: ./mocktest.sh python-mistune --define 'python3_pkgversion 3.11'
|
run: ./mocktest.sh python-mistune --define 'python3_pkgversion 3.11'
|
||||||
|
Loading…
Reference in New Issue
Block a user