From 7e7014eae6146ea5dd9719cf3d38fe52f36218d7 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Tue, 28 May 2019 08:47:55 +0200 Subject: [PATCH 1/4] use macros %autosetup and %pypi_source to simplify spec file --- weasyprint.spec | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/weasyprint.spec b/weasyprint.spec index 999b6fd..a62289a 100644 --- a/weasyprint.spec +++ b/weasyprint.spec @@ -5,7 +5,7 @@ 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}/%{name}-%{version}.tar.gz +Source0: %pypi_source # Fedora specific patch to remove use of /usr/bin/env in shebang in scripts Patch0: weasyprint-0.39-shebang.patch @@ -42,9 +42,7 @@ 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. %prep -%setup -q -n WeasyPrint-%{version} -%patch0 -p1 -b .shebang - +%autosetup -p1 -n WeasyPrint-%{version} find . -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|' %build From 1bf0e3476dc2b4e216746096fc91008bca70f058 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Tue, 28 May 2019 08:48:38 +0200 Subject: [PATCH 2/4] remove test code before installation This saves about 1.4 MB for each install. --- weasyprint.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/weasyprint.spec b/weasyprint.spec index a62289a..4eacd75 100644 --- a/weasyprint.spec +++ b/weasyprint.spec @@ -47,6 +47,8 @@ find . -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|' %build %py3_build +# do not ship tests +rm -rf weasyprint/tests %install %py3_install From 187a0737cb2560b67dcdb395941dae1196933f92 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Tue, 28 May 2019 08:49:35 +0200 Subject: [PATCH 3/4] avoid dependency on /usr/bin/python33 The custom patch + find/sed stepped on each other's toes so we ended up with weird shebangs like /usr/bin/python33 and even /usr/bin/python333 so the generated RPM required /usr/bin/python33 (which is not available in Fedora). Instead just use pathfix.py which does the job without having to update patch files manually for each release. --- weasyprint.spec | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/weasyprint.spec b/weasyprint.spec index 4eacd75..8440004 100644 --- a/weasyprint.spec +++ b/weasyprint.spec @@ -1,17 +1,15 @@ Name: weasyprint Version: 0.39 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Utility to render HTML and CSS to PDF License: BSD URL: http://weasyprint.org/ BuildArch: noarch Source0: %pypi_source -# Fedora specific patch to remove use of /usr/bin/env in shebang in scripts -Patch0: weasyprint-0.39-shebang.patch - Requires: python3-weasyprint = %{version}-%{release} BuildRequires: python3-devel python3-setuptools +BuildRequires: /usr/bin/pathfix.py %description WeasyPrint can render HTML and CSS to PDF. It aims to support web standards @@ -43,7 +41,7 @@ can export to PDF. It aims to support web standards for printing. %prep %autosetup -p1 -n WeasyPrint-%{version} -find . -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|' +pathfix.py -pni "%{__python3} %{py3_shbang_opts}" . %build %py3_build @@ -66,6 +64,9 @@ chmod +x %{buildroot}%{python3_sitelib}/weasyprint/tests/test_web/run.py %{python3_sitelib}/weasyprint/ %changelog +* Tue May 28 2019 Felix Schwarz 0.39-2 +- avoid dependency on Python 3.3 + * Tue Apr 30 2019 Eric Smith 0.39-1 - Update to newer (but not latest) upstream. From e5b6700480e5886d2b50fd1be455dd772624c4ff Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Tue, 28 May 2019 08:59:53 +0200 Subject: [PATCH 4/4] add direct requirement for python3-cairocffi (#1685654) Actually python3-cairocffi should have that dependency (see bug 1698217) but for now just add the requirement here. --- weasyprint.spec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/weasyprint.spec b/weasyprint.spec index 8440004..a34663e 100644 --- a/weasyprint.spec +++ b/weasyprint.spec @@ -27,6 +27,10 @@ Requires: python3-lxml >= 3.0 Requires: python3-pyphen >= 0.8 Requires: python3-setuptools Requires: python3-tinycss2 >= 0.5 +# workaround for bug 1685654 +# actually python3-cairocffi should have that dependency (see bug 1698217) but +# for now just add the requirement here. +Requires: python3-xcffib # 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: @@ -66,6 +70,7 @@ chmod +x %{buildroot}%{python3_sitelib}/weasyprint/tests/test_web/run.py %changelog * Tue May 28 2019 Felix Schwarz 0.39-2 - avoid dependency on Python 3.3 +- require python3-xcffib directly (#1685654) * Tue Apr 30 2019 Eric Smith 0.39-1 - Update to newer (but not latest) upstream.