# A header-only library has no debuginfo
%global debug_package %{nil}
Name: py3c
Version: 0.7
Release: 1%{?dist}
Summary: Guide and compatibility macros for porting extensions to Python 3
# Licences differ for subpackages
License: MIT and CC-BY-SA
URL: http://py3c.readthedocs.io/
Source0: https://github.com/encukou/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires: python2-devel
BuildRequires: python3-devel
BuildRequires: python3-sphinx
BuildRequires: python3-sphinx_rtd_theme
%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
# 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
# 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 doc
BuildArch: noarch
License: CC-BY-SA
Summary: Guide for porting C extensions to Python 3
Requires: python3-sphinx_rtd_theme
%description doc
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
diff -r $bundledfonts $themefonts
rm -rv $bundledfonts
ln -s $themefonts $bundledfonts
%check
export CFLAGS="%{optflags}"
make %{?_smp_mflags} test-python
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}
%files devel
%license LICENSE.MIT
%doc README.rst
%{_includedir}/py3c.h
%{_includedir}/py3c/
%{_datadir}/pkgconfig/py3c.pc
%files doc
%license doc/LICENSE.CC-BY-SA-3.0
%doc %{_pkgdocdir}/
%changelog
* Thu May 19 2016 Petr Viktorin <pviktorin@redhat.com> - 0.7-1
- Update to 0.7:
- Fix file shim tests on big endian architectures
(bug in the test suite only, does not affect behavior)
* Thu May 19 2016 Petr Viktorin <pviktorin@redhat.com> - 0.6-2
- Initial package