From 21e7d72573f8480765e03df85390bb1634b4ab5d Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Apr 30 2020 16:33:56 +0000 Subject: Adjust package to EPEL 7 & 8 --- diff --git a/py3c.spec b/py3c.spec index 922d655..5cfb1da 100644 --- a/py3c.spec +++ b/py3c.spec @@ -1,9 +1,19 @@ # A header-only library has no debuginfo %global debug_package %{nil} +%if (! 0%{?rhel}) || (0%{?rhel} >= 8) +# EL 8 has Sphinx and weak rependencies +%bcond_without docs +%bcond_without rpm_weak_deps +%else +%bcond_with docs +%bcond_with rpm_weak_deps +%endif + + Name: py3c Version: 1.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Guide and compatibility macros for porting extensions to Python 3 # Licences differ for subpackages @@ -15,9 +25,9 @@ Source0: https://github.com/encukou/%{name}/archive/v%{version}.tar.gz#/% BuildRequires: gcc BuildRequires: python2-devel -BuildRequires: python3-devel -BuildRequires: python3-sphinx -BuildRequires: python3-sphinx_rtd_theme +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-sphinx +BuildRequires: python%{python3_pkgversion}-sphinx_rtd_theme %description py3c helps you port C extensions to Python 3. @@ -29,10 +39,12 @@ and reduce boilerplate. License: MIT Summary: Header files for py3c +%if %{with rpm_weak_deps} # Do not *require* python?-devel, because some projects can drop support # for one of the Python versions, but still use the compat macros. Suggests: python2-devel -Suggests: python3-devel +Suggests: python%{python3_pkgversion}-devel +%endif # A header-only library counts as static Provides: %{name}-static = %{version}-%{release} @@ -42,6 +54,7 @@ Provides: %{name}-static = %{version}-%{release} %{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. +%if %{with docs} %package doc BuildArch: noarch License: CC-BY-SA @@ -52,6 +65,7 @@ Requires: python3-sphinx_rtd_theme %description doc Guide for porting CPython extensions from Python 2 to Python 3, using the py3c macros. +%endif %prep %setup -q @@ -59,6 +73,7 @@ py3c macros. %build make %{?_smp_mflags} py3c.pc includedir=%{_includedir} +%if %{with docs} make %{?_smp_mflags} doc SPHINXBUILD=sphinx-build-3 # unbundle fonts provided by the theme package @@ -67,6 +82,7 @@ themefonts=%{python3_sitelib}/sphinx_rtd_theme/static/fonts diff -r $bundledfonts $themefonts rm -rv $bundledfonts ln -s $themefonts $bundledfonts +%endif %check export CFLAGS="%{optflags}" @@ -75,8 +91,11 @@ make %{?_smp_mflags} test-python3 %install make install prefix=%{buildroot}%{_prefix} includedir=%{buildroot}%{_includedir} + +%if %{with docs} mkdir -p %{buildroot}%{_pkgdocdir} cp -rv doc/build/html/* %{buildroot}%{_pkgdocdir} +%endif # Strip buildroot name from the pkgconfig file sed --in-place -e's!%{buildroot}!!' %{buildroot}%{_datadir}/pkgconfig/py3c.pc @@ -88,11 +107,16 @@ sed --in-place -e's!%{buildroot}!!' %{buildroot}%{_datadir}/pkgconfig/py3c.pc %{_includedir}/py3c/ %{_datadir}/pkgconfig/py3c.pc +%if %{with docs} %files doc %license doc/LICENSE.CC-BY-SA-3.0 %doc %{_pkgdocdir}/ +%endif %changelog +* Thu Apr 30 2020 Petr Viktorin - 1.1-3 +- Switch to %%{python3_pkgversion} + * Thu Jan 30 2020 Fedora Release Engineering - 1.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild