py3c/py3c.spec
2022-11-15 11:03:46 +08:00

89 lines
2.5 KiB
RPMSpec

%global debug_package %{nil}
Name: py3c
Version: 1.2
Release: 3
Summary: Guide and compatibility macros for porting extensions to Python 3
# Licences differ for subpackages
License: MIT and CC-BY-SA-3.0
URL: http://py3c.readthedocs.io/
Source0: https://github.com/encukou/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
BuildRequires: python3-devel python3-setuptools python3-sphinx python3-sphinx_rtd_theme gcc
%description
py3c helps you port C extensions to Python 3.
It provides a detailed guide, and a set of macros to make porting easy
and reduce boilerplate.
%package devel
License: MIT
Summary: Header files for py3c
Requires: python3-devel
# A header-only library counts as static
Provides: %{name}-static = %{version}-%{release}
%{?_isa:Provides: %{name}-static%{?_isa} = %{version}-%{release}}
%description devel
%{name}-devel is only required for building software that uses py3c.
Because py3c is a header-only library, there is no matching run-time package.
%package help
BuildArch: noarch
License: CC-BY-SA
Summary: Guide for porting C extensions to Python 3
Requires: python3-sphinx_rtd_theme
%description help
Guide for porting CPython extensions from Python 2 to Python 3, using the py3c macros.
%prep
%setup -q
%build
make %{?_smp_mflags} py3c.pc includedir=%{_includedir}
make %{?_smp_mflags} doc SPHINXBUILD=sphinx-build-3
# unbundle fonts provided by the theme package
bundledfonts=doc/build/html/_static/fonts
themefonts=%{python3_sitelib}/sphinx_rtd_theme/static/fonts
ln -s $themefonts $bundledfonts
%check
export CFLAGS="%{optflags}"
make %{?_smp_mflags} test-python3
%install
make install prefix=%{buildroot}%{_prefix} includedir=%{buildroot}%{_includedir}
mkdir -p %{buildroot}%{_pkgdocdir}
cp -rv doc/build/html/* %{buildroot}%{_pkgdocdir}
# Strip buildroot name from the pkgconfig file
sed --in-place -e's!%{buildroot}!!' %{buildroot}%{_datadir}/pkgconfig/py3c.pc
%files devel
%license LICENSE.MIT
%doc README.rst
%{_includedir}/py3c.h
%{_includedir}/py3c/
%{_datadir}/pkgconfig/py3c.pc
%files help
%license doc/LICENSE.CC-BY-SA-3.0
%doc %{_pkgdocdir}/
%changelog
* Mon Nov 14 2022 caodongxia <caodongxia@h-partners.com> - 1.2-3
- Modify invalid source0
* Tue Jan 11 2022 xigaoxinyan <xigaoxinyan@huawei.com> - 1.2-2
- %build bundledfonts not exist
* Fri Jul 31 2020 yang_zhuang_zhuang <yangzhuangzhuang1@huawei.com> - 1.2-1
- package init