From: Hartmut Goebel <h.goebel@crazy-compilers.com>
To: 37617@debbugs.gnu.org
Subject: [bug#37617] [PATCH 6/6] gnu: Add weasyprint.
Date: Fri, 4 Oct 2019 13:08:24 +0200 [thread overview]
Message-ID: <20191004110824.16081-6-h.goebel@crazy-compilers.com> (raw)
In-Reply-To: <20191004110824.16081-1-h.goebel@crazy-compilers.com>
* gnu/packages/pdf.scm (weasyprint): New variable.
---
gnu/packages/pdf.scm | 81 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 9c7cc0b7d2..e0310ac89e 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -15,6 +15,7 @@
;;; Copyright © 2017, 2018 Rene Saavedra <pacoon@protonmail.com>
;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -65,6 +66,7 @@
#:use-module (gnu packages imagemagick)
#:use-module (gnu packages javascript)
#:use-module (gnu packages lesstif)
+ #:use-module (gnu packages libffi)
#:use-module (gnu packages linux)
#:use-module (gnu packages lua)
#:use-module (gnu packages pcre)
@@ -72,6 +74,8 @@
#:use-module (gnu packages photo)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
+ #:use-module (gnu packages python-check)
+ #:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages qt)
#:use-module (gnu packages sdl)
@@ -1158,3 +1162,80 @@ manipulating PDF documents from the command line. It supports
@item displaying the mapping between logical and physical page numbers
@end itemize")
(license license:bsd-3)))
+
+(define-public weasyprint
+ (package
+ (name "weasyprint")
+ (version "50")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "WeasyPrint" version))
+ (sha256
+ (base32 "0invs96zvmcr6wh5klj52jrcnr9qg150v9wpmbhcsf3vv1d1hbcw"))
+ (patches (search-patches "weasyprint-library-paths.patch"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-library-paths
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((fontconfig (assoc-ref inputs "fontconfig"))
+ (glib (assoc-ref inputs "glib"))
+ (pango (assoc-ref inputs "pango"))
+ (pangoft2 (assoc-ref inputs "pangoft2")))
+ (substitute* "weasyprint/fonts.py"
+ (("@fontconfig@")
+ (string-append fontconfig "/lib/libfontconfig.so"))
+ (("@pangoft2@")
+ (string-append pango "/lib/libpangoft2-1.0.so")))
+ (substitute* "weasyprint/text.py"
+ (("@gobject@")
+ (string-append glib "/lib/libgobject-2.0.so"))
+ (("@pango@")
+ (string-append pango "/lib/libpango-1.0.so"))
+ (("@pangocairo@")
+ (string-append pango "/lib/libpangocairo-1.0.so"))))))
+ (add-after 'unpack 'remove-pytest-options
+ (lambda _
+ (substitute* "setup.cfg"
+ ;; flake8 and isort syntax checks fail, which is not our
+ ;; business
+ (("addopts = --flake8 --isort") ""))))
+ (replace 'check
+ (lambda _
+ ;; run pytest, excluding one failing test
+ (invoke "pytest" "-k" "not test_flex_column_wrap_reverse"))))))
+ (inputs
+ `(("fontconfig" ,fontconfig)
+ ("glib" ,glib)
+ ("pango" ,pango)))
+ (propagated-inputs
+ `(("gdk-pixbuf" ,gdk-pixbuf)
+ ("python-cairocffi" ,python-cairocffi)
+ ("python-cairosvg" ,python-cairosvg)
+ ("python-cffi" ,python-cffi)
+ ("python-cssselect2" ,python-cssselect2)
+ ("python-html5lib" ,python-html5lib)
+ ("python-pyphen" ,python-pyphen)
+ ("python-tinycss2" ,python-tinycss2)))
+ (native-inputs
+ `(("python-pytest-cov" ,python-pytest-cov)
+ ("python-pytest-runner" ,python-pytest-runner)))
+ (home-page "https://weasyprint.org/")
+ (synopsis "Document factory for creating PDF files from HTML")
+ (description "WeasyPrint helps web developers to create PDF documents. It
+turns simple HTML pages into gorgeous statistical reports, invoices, tickets,
+etc.
+
+From a technical point of view, WeasyPrint is a visual rendering engine for
+HTML and CSS that can export to PDF and PNG. It aims to support web standards
+for printing.
+
+It is based on various libraries but not on a full rendering engine like
+WebKit or Gecko. The CSS layout engine is written in Python, designed for
+pagination, and meant to be easy to hack on. Weasyprint can also be used as a
+python library.
+
+Keywords: html2pdf, htmltopdf")
+ (license license:bsd-3)))
--
2.21.0
next prev parent reply other threads:[~2019-10-04 11:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-04 11:06 [bug#37617] [PATCH 0/6] Add weasyprint and dependencies Hartmut Goebel
2019-10-04 11:08 ` [bug#37617] [PATCH 1/6] gnu: Add python-pytest-isort Hartmut Goebel
2019-10-04 11:08 ` [bug#37617] [PATCH 2/6] gnu: Add python-tinycss2 Hartmut Goebel
2019-10-04 11:08 ` [bug#37617] [PATCH 3/6] gnu: Add python-cssselect2 Hartmut Goebel
2019-10-04 11:08 ` [bug#37617] [PATCH 4/6] gnu: Add python-cairosvg Hartmut Goebel
2019-10-04 11:08 ` [bug#37617] [PATCH 5/6] gnu: Add python-pyphen Hartmut Goebel
2019-10-04 11:08 ` Hartmut Goebel [this message]
[not found] ` <handler.37617.B.157018720926483.ack@debbugs.gnu.org>
2019-10-22 15:02 ` bug#37617: Acknowledgement ([PATCH 0/6] Add weasyprint and dependencies.) Hartmut Goebel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191004110824.16081-6-h.goebel@crazy-compilers.com \
--to=h.goebel@crazy-compilers.com \
--cc=37617@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).