aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/pdf.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/pdf.scm')
-rw-r--r--gnu/packages/pdf.scm66
1 files changed, 42 insertions, 24 deletions
diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 879bc7f93f..a06f351aae 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -20,6 +20,7 @@
;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -59,6 +60,7 @@
#:use-module (gnu packages cups)
#:use-module (gnu packages curl)
#:use-module (gnu packages djvu)
+ #:use-module (gnu packages fonts)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages game-development)
#:use-module (gnu packages gcc)
@@ -1428,14 +1430,17 @@ manipulating PDF documents from the command line. It supports
(define-public weasyprint
(package
(name "weasyprint")
- (version "51")
+ (version "52.1")
(source
(origin
- (method url-fetch)
- (uri (pypi-uri "WeasyPrint" version))
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/FelixSchwarz/WeasyPrint")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
(sha256
- (base32 "0skdzwq7cd715dnnds6abx0k0xmmnmsqp0vb1r1w20sg7abp3sdk"))
- (patches (search-patches "weasyprint-library-paths.patch"))))
+ (base32
+ "0rcj9yah3bp6bbvkmny3w4csx4l5v49lc7mrk29g0x77qnwswjy7"))))
(build-system python-build-system)
(arguments
`(#:phases
@@ -1447,27 +1452,39 @@ manipulating PDF documents from the command line. It supports
(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")))
+ (("'fontconfig'")
+ (format #f "'~a/lib/libfontconfig.so'" fontconfig))
+ (("'pangoft2-1.0'")
+ (format #f "'~a/lib/libpangoft2-1.0.so'" pango)))
(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
+ (("'gobject-2.0'")
+ (format #f "'~a/lib/libgobject-2.0.so'" glib))
+ (("'pango-1.0'")
+ (format #f "'~a/lib/libpango-1.0.so'" pango))
+ (("'pangocairo-1.0'")
+ (format #f "'~a/lib/libpangocairo-1.0.so'" pango)))
+ #t)))
+ (add-after 'unpack 'disable-linters
+ ;; Their check fails; none of our business.
(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"))))))
+ ((".*pytest-flake8.*") "")
+ ((".*pytest-isort.*") "")
+ (("--flake8") "")
+ (("--isort") ""))
+ #t))
+ (add-before 'check 'register-dejavu-font
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; TODO: fix FreeType so that fonts found in XDG_DATA_DIRS are
+ ;; honored.
+ (let* ((HOME "/tmp")
+ (dejavu (assoc-ref inputs "font-dejavu"))
+ (fonts-dir (string-append HOME "/.fonts")))
+ (setenv "HOME" HOME)
+ (mkdir-p fonts-dir)
+ (symlink (string-append dejavu "/share/fonts/truetype")
+ (string-append fonts-dir "/truetype"))
+ (invoke "fc-cache" "-rv")))))))
(inputs
`(("fontconfig" ,fontconfig)
("glib" ,glib)
@@ -1482,7 +1499,8 @@ manipulating PDF documents from the command line. It supports
("python-pyphen" ,python-pyphen)
("python-tinycss2" ,python-tinycss2)))
(native-inputs
- `(("python-pytest-cov" ,python-pytest-cov)
+ `(("font-dejavu" ,font-dejavu) ;tests depend on it
+ ("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")