diff options
Diffstat (limited to 'gnu/packages/pdf.scm')
-rw-r--r-- | gnu/packages/pdf.scm | 305 |
1 files changed, 151 insertions, 154 deletions
diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm index 4d3bc76473..5645457411 100644 --- a/gnu/packages/pdf.scm +++ b/gnu/packages/pdf.scm @@ -13,14 +13,14 @@ ;;; Copyright © 2017, 2018 Leo Famulari <leo@famulari.name> ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com> ;;; Copyright © 2017, 2018 Rene Saavedra <pacoon@protonmail.com> -;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr> +;;; Copyright © 2017–2022 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com> ;;; Copyright © 2019 Ben Sturmfels <ben@sturm.com.au> ;;; Copyright © 2019,2020 Hartmut Goebel <h.goebel@crazy-compilers.com> ;;; Copyright © 2020-2022 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> +;;; Copyright © 2020, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> ;;; ;;; This file is part of GNU Guix. @@ -89,6 +89,7 @@ #:use-module (gnu packages pkg-config) #:use-module (gnu packages pulseaudio) #:use-module (gnu packages python) + #:use-module (gnu packages python-build) #:use-module (gnu packages python-check) #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) @@ -716,63 +717,92 @@ for applications that wish to do lower level manipulation of PDF, such as extracting content or merging files.") (license license:lgpl2.0+))) +(define-public python-pydyf + (package + (name "python-pydyf") + (version "0.1.2") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pydyf" version)) + (sha256 + (base32 "0b30g3hhxw1bg18r9ax85i1dkg8vy1y1wzas0bg0bxblh7j5sbqy")))) + (build-system python-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "pytest" "-vv" "-c" "/dev/null"))))))) + (propagated-inputs (list python-pillow)) + (native-inputs (list ghostscript python-pytest)) + (home-page "https://github.com/CourtBouillon/pydyf") + (synopsis "Low-level PDF generator") + (description "@code{pydyf} is a low-level PDF generator written in Python +and based on PDF specification 1.7.") + (license license:bsd-3))) + (define-public mupdf (package (name "mupdf") - (version "1.19.0") + (version "1.19.1") (source (origin (method url-fetch) (uri (string-append "https://mupdf.com/downloads/archive/" "mupdf-" version "-source.tar.xz")) (sha256 - (base32 "1i98xqgnzp168hnnhradl8658qsif06wlbvcglz0mmh8wi1rkwrq")) + (base32 "0gl0wf16m1cafs20h3v1f4ysf7zlbijjyd6s1r1krwvlzriwdsmm")) (modules '((guix build utils))) (snippet - '(begin - ;; Remove bundled software. - (let* ((keep (list "extract" - "lcms2")) ; different from our lcms2 package - (from "thirdparty") - (kept (string-append from "~temp"))) - (mkdir-p kept) - (for-each (lambda (file) (rename-file (string-append from "/" file) - (string-append kept "/" file))) - keep) - (delete-file-recursively from) - (rename-file kept from)) - #t)))) + #~(begin + ;; Remove bundled software. + (let* ((keep (list "extract" + "lcms2")) ; different from our lcms2 package + (from "thirdparty") + (kept (string-append from "~temp"))) + (mkdir-p kept) + (for-each (lambda (file) + (rename-file (string-append from "/" file) + (string-append kept "/" file))) + keep) + (delete-file-recursively from) + (rename-file kept from)))))) (build-system gnu-build-system) (inputs - `(("curl" ,curl) - ("freeglut" ,freeglut) - ("freetype" ,freetype) - ("gumbo-parser" ,gumbo-parser) - ("harfbuzz" ,harfbuzz) - ("jbig2dec" ,jbig2dec) - ("libjpeg" ,libjpeg-turbo) - ("libx11" ,libx11) - ("libxext" ,libxext) - ("mujs" ,mujs) - ("openjpeg" ,openjpeg) - ("openssl" ,openssl) - ("zlib" ,zlib))) + (list curl + freeglut + freetype + gumbo-parser + harfbuzz + jbig2dec + libjpeg-turbo + libx11 + libxext + mujs + openjpeg + openssl + zlib)) (native-inputs - (list pkg-config)) + (list pkg-config)) (arguments - `(#:tests? #f ; no check target - #:make-flags (list "verbose=yes" - (string-append "CC=" ,(cc-for-target)) - "XCFLAGS=-fpic" - "USE_SYSTEM_LIBS=yes" - "USE_SYSTEM_MUJS=yes" - "shared=yes" - ;; Even with the linkage patch we must fix RUNPATH. - (string-append "LDFLAGS=-Wl,-rpath=" - (assoc-ref %outputs "out") "/lib") - (string-append "prefix=" (assoc-ref %outputs "out"))) - #:phases (modify-phases %standard-phases - (delete 'configure)))) ; no configure script + (list + #:tests? #f ; no check target + #:make-flags + #~(list "verbose=yes" + (string-append "CC=" #$(cc-for-target)) + "XCFLAGS=-fpic" + "USE_SYSTEM_LIBS=yes" + "USE_SYSTEM_MUJS=yes" + "shared=yes" + ;; Even with the linkage patch we must fix RUNPATH. + (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib") + (string-append "prefix=" #$output)) + #:phases + #~(modify-phases %standard-phases + (delete 'configure)))) ; no configure script (home-page "https://mupdf.com") (synopsis "Lightweight PDF viewer and toolkit") (description @@ -1032,13 +1062,10 @@ of rich PDF documents, and also creation of charts in a variety of bitmap and vector formats.") (license license:bsd-3))) -(define-public python2-reportlab - (package-with-python2 python-reportlab)) - (define-public impressive (package (name "impressive") - (version "0.12.1") + (version "0.13.1") (source (origin (method url-fetch) (uri (string-append @@ -1046,36 +1073,33 @@ vector formats.") version "/Impressive-" version ".tar.gz")) (sha256 (base32 - "1r7ihv41awnlnlry1kymb8fka053wdhzibfwcarn78rr3vs338vl")))) + "0d1d2jxfl9vmy4swcdz660xd4wx91w1i3n07k522pccapwxig294")))) (build-system python-build-system) - - ;; TODO: Add dependency on pdftk. - (inputs (list python2-pygame python2-pillow sdl xpdf)) - (arguments - `(#:python ,python-2 - #:phases (modify-phases %standard-phases - (delete 'build) - (delete 'configure) - (delete 'check) - (replace 'install - (lambda* (#:key inputs outputs #:allow-other-keys) - ;; There's no 'setup.py' so install things manually. - (let* ((out (assoc-ref outputs "out")) - (bin (string-append out "/bin")) - (man1 (string-append out "/share/man/man1")) - (sdl (assoc-ref inputs "sdl")) - (xpdf (assoc-ref inputs "xpdf"))) - (mkdir-p bin) - (copy-file "impressive.py" - (string-append bin "/impressive")) - (wrap-program (string-append bin "/impressive") - `("LIBRARY_PATH" ":" prefix ;for ctypes - (,(string-append sdl "/lib"))) - `("PATH" ":" prefix ;for pdftoppm - (,(string-append xpdf "/bin")))) - (install-file "impressive.1" man1) - #t)))))) + (list + #:phases + #~(modify-phases %standard-phases + (delete 'build) + (delete 'configure) + (delete 'check) + (replace 'install + (lambda* (#:key inputs #:allow-other-keys) + ;; There's no 'setup.py' so install things manually. + (let* ((bin (string-append #$output "/bin")) + (impressive (string-append bin "/impressive")) + (man1 (string-append #$output "/share/man/man1"))) + (mkdir-p bin) + (copy-file "impressive.py" impressive) + (chmod impressive #o755) + (wrap-program (string-append bin "/impressive") + `("LIBRARY_PATH" ":" prefix ;for ctypes + (,(string-append #$(this-package-input "sdl") + "/lib"))) + `("PATH" ":" prefix ;for pdftoppm + (,(search-input-file inputs "bin/xpdf")))) + (install-file "impressive.1" man1))))))) + ;; TODO: Add dependency on pdftk. + (inputs (list python-pygame python-pillow sdl xpdf)) (home-page "http://impressive.sourceforge.net") (synopsis "PDF presentation tool with visual effects") (description @@ -1088,13 +1112,13 @@ the PDF pages.") (define-public img2pdf (package (name "img2pdf") - (version "0.4.3") + (version "0.4.4") (source (origin (method url-fetch) (uri (pypi-uri "img2pdf" version)) (sha256 - (base32 "17z0bn8kihiyqjd1m5jr80m7ry06l1qn0l8v918xg5gs7q2calcf")))) + (base32 "0g3rpq68y5phnlgxrqn39k10j9nmgksg6m5ic8wgs8v5cjlrij4f")))) (build-system python-build-system) (propagated-inputs (list python-pikepdf python-pillow @@ -1229,31 +1253,6 @@ manipulation in memory. It is therefore a useful tool for websites that manage or manipulate PDFs.") (license license:bsd-3))) -(define-public python2-pypdf2 - (package-with-python2 python-pypdf2)) - -(define-public python2-pypdf - (package - (name "python2-pypdf") - (version "1.13") - (source (origin - (method url-fetch) - (uri (pypi-uri "pyPdf" version)) - (sha256 - (base32 - "0fqfvamir7k41w84c73rghzkiv891gdr17q5iz4hgbf6r71y9v9s")))) - (build-system python-build-system) - (arguments - `(#:tests? #f ; no tests - #:python ,python-2)) - (home-page "http://pybrary.net/pyPdf/") - (synopsis "Pure Python PDF toolkit") - (description "PyPDF2 is a pure Python PDF toolkit. - -Note: This module isn't maintained anymore. For new projects please use -python-pypdf2 instead.") - (license license:bsd-3))) - (define-public pdfarranger (package (name "pdfarranger") @@ -1467,77 +1466,75 @@ manipulating PDF documents from the command line. It supports (define-public weasyprint (package (name "weasyprint") - (version "52.1") + (version "54.3") (source (origin (method git-fetch) (uri (git-reference - (url "https://github.com/FelixSchwarz/WeasyPrint") + (url "https://github.com/Kozea/WeasyPrint") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 - "0rcj9yah3bp6bbvkmny3w4csx4l5v49lc7mrk29g0x77qnwswjy7")))) + "0cn8gpgyic6pmrnhp0540nbgplpsd5aybi7k89anz6m1sshgjzgs")))) (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'") - (format #f "'~a/lib/libfontconfig.so'" fontconfig)) - (("'pangoft2-1.0'") - (format #f "'~a/lib/libpangoft2-1.0.so'" pango))) - (substitute* "weasyprint/text.py" - (("'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" - ((".*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) - ("pango" ,pango))) + (list + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-library-paths + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "weasyprint/text/ffi.py" + (("'gobject-2.0-0'") + (format #f "~s" + (search-input-file inputs "lib/libgobject-2.0.so"))) + (("'pango-1.0-0'") + (format #f "~s" + (search-input-file inputs "lib/libpango-1.0.so"))) + (("'harfbuzz'") + (format #f "~s" + (search-input-file inputs "lib/libharfbuzz.so"))) + (("'fontconfig-1'") + (format #f "~s" + (search-input-file inputs "lib/libfontconfig.so"))) + (("'pangoft2-1.0-0'") + (format #f "~s" + (search-input-file inputs + "lib/libpangoft2-1.0.so")))))) + ;; XXX: PEP 517 manual build copied from python-isort. + (replace 'build + (lambda _ + (invoke "python" "-m" "build" "--wheel" "--no-isolation" "."))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "pytest" "-vv" "-c" "/dev/null" + "-n" (number->string (parallel-job-count)))))) + (replace 'install + (lambda _ + (let ((whl (car (find-files "dist" "\\.whl$")))) + (invoke "pip" "--no-cache-dir" "--no-input" + "install" "--no-deps" "--prefix" #$output whl))))))) + (inputs (list fontconfig glib harfbuzz pango)) (propagated-inputs (list gdk-pixbuf python-cairocffi python-cairosvg python-cffi python-cssselect2 + python-fonttools-full python-html5lib + python-pillow + python-pydyf python-pyphen python-tinycss2)) (native-inputs - (list font-dejavu ;tests depend on it - python-pytest-cov python-pytest-runner)) + (list font-dejavu ;tests depend on it + ghostscript + python-flit-core + python-pypa-build + python-pytest + python-pytest-xdist)) (home-page "https://weasyprint.org/") (synopsis "Document factory for creating PDF files from HTML") (description "WeasyPrint helps web developers to create PDF documents. It |