diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2020-11-20 09:42:12 -0500 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2020-11-29 14:02:48 -0500 |
commit | c601e2bf9adb05dc9dd9f3a565f693e968eb785c (patch) | |
tree | 5e9484e4043df410d167c343e53b92590480ebd0 /gnu | |
parent | e59a26cf3e08ca380650b60ae44edd1fd2b02322 (diff) | |
download | guix-c601e2bf9adb05dc9dd9f3a565f693e968eb785c.tar.gz |
gnu: weasyprint: Update to 52.1.
Fixes <https://issues.guix.gnu.org/42409>. * gnu/packages/patches/weasyprint-library-paths.patch: Delete. * gnu/packages/pdf.scm (weasyprint): Update to 52.1 [phases]{patch-library-paths}: Adjust. {check}: Remove. {register-dejavu-font}: New phase. [native-inputs]: Add font-dejavu.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/local.mk | 1 | ||||
-rw-r--r-- | gnu/packages/patches/weasyprint-library-paths.patch | 43 | ||||
-rw-r--r-- | gnu/packages/pdf.scm | 66 |
3 files changed, 42 insertions, 68 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index 4ea3d506f5..80f87691fe 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1695,7 +1695,6 @@ dist_patch_DATA = \ %D%/packages/patches/vte-CVE-2012-2738-pt1.patch \ %D%/packages/patches/vte-CVE-2012-2738-pt2.patch \ %D%/packages/patches/warsow-qfusion-fix-bool-return-type.patch \ - %D%/packages/patches/weasyprint-library-paths.patch \ %D%/packages/patches/webkitgtk-share-store.patch \ %D%/packages/patches/webkitgtk-bind-all-fonts.patch \ %D%/packages/patches/websocketpp-fix-for-cmake-3.15.patch \ diff --git a/gnu/packages/patches/weasyprint-library-paths.patch b/gnu/packages/patches/weasyprint-library-paths.patch deleted file mode 100644 index 317f0c542e..0000000000 --- a/gnu/packages/patches/weasyprint-library-paths.patch +++ /dev/null @@ -1,43 +0,0 @@ -Make weasyprint load dynamic libraries from hard-coded path. - -From NixOS -pkgs/development/python-modules/weasyprint/library-paths.patch - -diff --git a/weasyprint/fonts.py b/weasyprint/fonts.py -index 377716c1..2016e01c 100644 ---- a/weasyprint/fonts.py -+++ b/weasyprint/fonts.py -@@ -48,11 +48,8 @@ else: - # with OSError: dlopen() failed to load a library: cairo / cairo-2 - # So let's hope we find the same file as cairo already did ;) - # Same applies to pangocairo requiring pangoft2 -- fontconfig = dlopen(ffi, 'fontconfig', 'libfontconfig', -- 'libfontconfig-1.dll', -- 'libfontconfig.so.1', 'libfontconfig-1.dylib') -- pangoft2 = dlopen(ffi, 'pangoft2-1.0', 'libpangoft2-1.0-0', -- 'libpangoft2-1.0.so', 'libpangoft2-1.0.dylib') -+ fontconfig = dlopen(ffi, '@fontconfig@') -+ pangoft2 = dlopen(ffi, '@pangoft2@') - - ffi.cdef(''' - // FontConfig -diff --git a/weasyprint/text.py b/weasyprint/text.py -index 035074e9..08e40395 100644 ---- a/weasyprint/text.py -+++ b/weasyprint/text.py -@@ -243,12 +243,9 @@ def dlopen(ffi, *names): - return ffi.dlopen(names[0]) # pragma: no cover - - --gobject = dlopen(ffi, 'gobject-2.0', 'libgobject-2.0-0', 'libgobject-2.0.so', -- 'libgobject-2.0.dylib') --pango = dlopen(ffi, 'pango-1.0', 'libpango-1.0-0', 'libpango-1.0.so', -- 'libpango-1.0.dylib') --pangocairo = dlopen(ffi, 'pangocairo-1.0', 'libpangocairo-1.0-0', -- 'libpangocairo-1.0.so', 'libpangocairo-1.0.dylib') -+gobject = dlopen(ffi, '@gobject@') -+pango = dlopen(ffi, '@pango@') -+pangocairo = dlopen(ffi, '@pangocairo@') - - gobject.g_type_init() - 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") |