%if 0%{?fedora} > 12 %global with_python3 1 %else %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} %endif Name: weasyprint Version: 0.22 Release: 5%{?dist} Group: Applications/File Summary: Utility to render HTML and CSS to PDF License: BSD URL: http://weasyprint.org/ BuildArch: noarch Source0: https://github.com/Kozea/WeasyPrint/archive/v%{version}.tar.gz # Fedora specific patch to remove use of /usr/bin/env in shebang in scripts Patch0: weasyprint-0.19.2-shebang.patch BuildRequires: python2-devel python-setuptools Requires: python-weasyprint = %{version}-%{release} %if 0%{?with_python3} BuildRequires: python3-devel python3-setuptools %endif # if with_python3 %description WeasyPrint can render HTML and CSS to PDF. It aims to support web standards for printing. %package -n python-weasyprint Group: Development/Libraries Summary: Python library to render HTML and CSS to PDF Requires: python-tinycss python-cssselect python-pyphen Requires: python-html5lib >= 1:0.999 Requires: python-cairocffi python-cairosvg Requires: python-setuptools Requires: python-lxml Requires: hyphen pango # Weasyprint will fail if no fonts are installed. There's no way to know # what fonts the user would actually want, but require a few common ones # that might be useful: Requires: dejavu-fonts-common Requires: dejavu-sans-fonts Requires: dejavu-sans-mono-fonts Requires: dejavu-serif-fonts %description -n python-weasyprint The WeasyPrint Python library is a rendering engine for HTML and CSS that can export to PDF. It aims to support web standards for printing. %if 0%{?with_python3} %package -n python3-weasyprint Group: Development/Libraries Summary: Python library to render HTML and CSS to PDF Requires: python3-tinycss python3-cssselect python3-pyphen Requires: python3-html5lib >= 0.99 Requires: python3-cairocffi python3-CairoSVG Requires: python3-setuptools Requires: python3-lxml Requires: hyphen pango # Weasyprint will fail if no fonts are installed. There's no way to know # what fonts the user would actually want, but require a few common ones # that might be useful: Requires: dejavu-fonts-common Requires: dejavu-sans-fonts Requires: dejavu-sans-mono-fonts Requires: dejavu-serif-fonts %description -n python3-weasyprint The WeasyPrint Python library is a rendering engine for HTML and CSS that can export to PDF. It aims to support web standards for printing. %endif # if with_python3 %prep %setup -q -n WeasyPrint-%{version} %patch0 -p1 -b .shebang %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|' %endif # with_python3 %build %{__python} setup.py build %if 0%{?with_python3} pushd %{py3dir} # rpmbuild defaults to exporting LANG="C", which screws up Python 3's # default encoidng, and breaks setup.py reading cairocffi/__init__.py, # even though that file has an explicit tag of being UTF-8. LANG="en_US.UTF-8" %{__python3} setup.py build popd %endif # with_python3 %install %{__python} setup.py install --skip-build --prefix=%{_prefix} --root %{buildroot} chmod +x %{buildroot}%{python_sitelib}/weasyprint/tests/test_web/run.py %if 0%{?with_python3} pushd %{py3dir} LANG="en_US.UTF-8" %{__python3} setup.py install --skip-build --prefix=%{_prefix} --root %{buildroot} chmod +x %{buildroot}%{python3_sitelib}/weasyprint/tests/test_web/run.py popd %endif # with_python3 %files %doc AUTHORS LICENSE README %{_bindir}/weasyprint %files -n python-weasyprint %doc AUTHORS CHANGES LICENSE README %{python_sitelib}/* %if 0%{?with_python3} %files -n python3-weasyprint %doc AUTHORS CHANGES LICENSE README %{python3_sitelib}/* %endif # with_python3 %changelog * Tue Jul 19 2016 Fedora Release Engineering - 0.22-5 - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages * Fri Feb 05 2016 Fedora Release Engineering - 0.22-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild * Tue Nov 10 2015 Fedora Release Engineering - 0.22-3 - Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 * Fri Jun 19 2015 Fedora Release Engineering - 0.22-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Thu Aug 28 2014 Eric Smith 0.22-1 - Update to lastest upstream. - No Python 3 in EL7. * Sun Jun 08 2014 Fedora Release Engineering - 0.21-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Wed May 28 2014 Kalev Lember - 0.21-4 - Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4 * Thu Mar 20 2014 Eric Smith 0.21-3 - Add Python 3 support. - Require python-html5lib 0.999, which has epoch 1 because that is newer than upstream 1.0b2. * Fri Mar 14 2014 Eric Smith 0.21-2 - Add some missing Requires (#1076734). * Mon Mar 10 2014 Eric Smith 0.21-1 - Update to lastest upstream. * Sun Jul 28 2013 Eric Smith 0.19.2-3 - Remove /usr/bin/env from Python script shebang lines. * Sun Jul 21 2013 Eric Smith 0.19.2-2 - Fixed dependencies. * Sat Jul 20 2013 Eric Smith 0.19.2-1 - initial version