Simplify the spec file by reducing macro indirection

This commit is contained in:
Benjamin A. Beasley 2024-01-01 15:03:47 -05:00
parent 6a79a5062e
commit 3b698e8e93

View File

@ -1,6 +1,4 @@
%global srcname cffsubr Name: python-cffsubr
Name: python-%{srcname}
Version: 0.2.9.post1 Version: 0.2.9.post1
Release: 9%{?dist} Release: 9%{?dist}
Summary: Standalone CFF subroutinizer based on the AFDKO tx tool Summary: Standalone CFF subroutinizer based on the AFDKO tx tool
@ -12,10 +10,10 @@ Summary: Standalone CFF subroutinizer based on the AFDKO tx tool
# • tests/data/SourceSansVariable-Regular.subset.ttx # • tests/data/SourceSansVariable-Regular.subset.ttx
# See NOTICE. # See NOTICE.
License: Apache-2.0 License: Apache-2.0
URL: https://pypi.org/project/%{srcname} URL: https://pypi.org/project/cffsubr
Source0: %{pypi_source %{srcname}} Source0: %{pypi_source cffsubr}
# Written for Fedora in groff_man(7) format based on the output of “cffsubr --help” # Written for Fedora in groff_man(7) format based on the output of “cffsubr --help”
Source1: %{srcname}.1 Source1: cffsubr.1
# Handle importlib.resources.path removal in Python 3.13 # Handle importlib.resources.path removal in Python 3.13
# https://github.com/adobe-type-tools/cffsubr/pull/24 # https://github.com/adobe-type-tools/cffsubr/pull/24
@ -38,16 +36,16 @@ Standalone CFF subroutinizer based on the AFDKO tx tool.
%generate_buildrequires %generate_buildrequires
%pyproject_buildrequires -x testing %pyproject_buildrequires -x testing
%package -n python3-%{srcname} %package -n python3-cffsubr
Summary: %{summary} Summary: %{summary}
Requires: %{txbin} Requires: %{txbin}
%description -n python3-%{srcname} %description -n python3-cffsubr
Standalone CFF subroutinizer based on the AFDKO tx tool. Standalone CFF subroutinizer based on the AFDKO tx tool.
%prep %prep
%autosetup -n %{srcname}-%{version} -p1 %autosetup -n cffsubr-%{version} -p1
# Patch out setuptools-git-ls-files dependency # Patch out setuptools-git-ls-files dependency
sed -r -i '/setuptools-git-ls-files/d' setup.py pyproject.toml sed -r -i '/setuptools-git-ls-files/d' setup.py pyproject.toml
@ -66,39 +64,40 @@ cp -p '%{SOURCE1}' .
%install %install
%pyproject_install %pyproject_install
%pyproject_save_files -l %{srcname} %pyproject_save_files -l cffsubr
# Workaround to prevent a dangling symlink: # Workaround to prevent a dangling symlink:
install -d "%{buildroot}$(dirname '%{txbin}')" install -d "%{buildroot}$(dirname '%{txbin}')"
ln -s '%{txbin}' '%{buildroot}%{txbin}' ln -s '%{txbin}' '%{buildroot}%{txbin}'
# Build a relative symbolic link: # Build a relative symbolic link:
ln -s '%{buildroot}%{txbin}' %{buildroot}/%{python3_sitelib}/%{srcname}/tx ln -s '%{buildroot}%{txbin}' %{buildroot}/%{python3_sitelib}/cffsubr/tx
symlinks -c -o %{buildroot}/%{python3_sitelib}/%{srcname}/tx symlinks -c -o %{buildroot}/%{python3_sitelib}/cffsubr/tx
install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 '%{srcname}.1' install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 'cffsubr.1'
%check %check
%pytest %pytest
%files -n python3-%{srcname} -f %{pyproject_files} %files -n python3-cffsubr -f %{pyproject_files}
# pyproject-rpm-macros handles the LICENSE file; verify with “rpm -qL -p …” # pyproject-rpm-macros handles the LICENSE file; verify with “rpm -qL -p …”
%doc README.md %doc README.md
# Symbolic link to the “tx” executable; we patched out building a separate copy # Symbolic link to the “tx” executable; we patched out building a separate copy
# for the Python package, so the Python build does not know about this and we # for the Python package, so the Python build does not know about this and we
# must list it explicitly. # must list it explicitly.
%{python3_sitelib}/%{srcname}/tx %{python3_sitelib}/cffsubr/tx
# This was just a workaround: # This was just a workaround:
%exclude %{txbin} %exclude %{txbin}
%{_bindir}/%{srcname} %{_bindir}/cffsubr
%{_mandir}/man1/%{srcname}.1* %{_mandir}/man1/cffsubr.1*
%changelog %changelog
* Mon Jan 01 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.9.post1-9 * Mon Jan 01 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.9.post1-9
- Assert %%pyproject_files contains a license file - Assert %%pyproject_files contains a license file
- Remove an obsolete conditional - Remove an obsolete conditional
- Simplify the spec file by reducing macro indirection
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.9.post1-8 * Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.9.post1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild