Archived
1
0
Fork 0

gnu: weasyprint: Update to 54.3.

* gnu/packages/pdf.scm (weasyprint): Update to 54.3.
[source]: Update git URL.
[phases]: Use gexps.
{disable-linters}: Delete phase.
{register-dejavu-font}: Remove obsolete phase.
{patch-library-paths}: Adjust for code changes. Use search-input-file.
{check}: Streamline and use xdist.
{build, install}: Override to o a PEP 517 build.
[inputs]: Add harfbuzz.
[propagated-inputs]: Add python-fonttools-full, python-pillow and
python-pydyf.
[native-inputs]: Remove python-pytest-cov and python-pytest-runner.
Add ghostscript, python-flit-core, python-pypa-build, python-pytest and
python-pytest-xdist.
This commit is contained in:
Maxim Cournoyer 2022-04-20 00:46:18 -04:00
parent e7b0d63e32
commit 84943a4e0e
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -88,6 +88,7 @@
#:use-module (gnu packages pkg-config) #:use-module (gnu packages pkg-config)
#:use-module (gnu packages pulseaudio) #:use-module (gnu packages pulseaudio)
#:use-module (gnu packages python) #:use-module (gnu packages python)
#:use-module (gnu packages python-build)
#:use-module (gnu packages python-check) #:use-module (gnu packages python-check)
#:use-module (gnu packages python-web) #:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz) #:use-module (gnu packages python-xyz)
@ -1480,77 +1481,75 @@ manipulating PDF documents from the command line. It supports
(define-public weasyprint (define-public weasyprint
(package (package
(name "weasyprint") (name "weasyprint")
(version "52.1") (version "54.3")
(source (source
(origin (origin
(method git-fetch) (method git-fetch)
(uri (git-reference (uri (git-reference
(url "https://github.com/FelixSchwarz/WeasyPrint") (url "https://github.com/Kozea/WeasyPrint")
(commit (string-append "v" version)))) (commit (string-append "v" version))))
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32
"0rcj9yah3bp6bbvkmny3w4csx4l5v49lc7mrk29g0x77qnwswjy7")))) "0cn8gpgyic6pmrnhp0540nbgplpsd5aybi7k89anz6m1sshgjzgs"))))
(build-system python-build-system) (build-system python-build-system)
(arguments (arguments
`(#:phases (list
(modify-phases %standard-phases #:phases
(add-after 'unpack 'patch-library-paths #~(modify-phases %standard-phases
(lambda* (#:key inputs #:allow-other-keys) (add-after 'unpack 'patch-library-paths
(let ((fontconfig (assoc-ref inputs "fontconfig")) (lambda* (#:key inputs #:allow-other-keys)
(glib (assoc-ref inputs "glib")) (substitute* "weasyprint/text/ffi.py"
(pango (assoc-ref inputs "pango")) (("'gobject-2.0-0'")
(pangoft2 (assoc-ref inputs "pangoft2"))) (format #f "~s"
(substitute* "weasyprint/fonts.py" (search-input-file inputs "lib/libgobject-2.0.so")))
(("'fontconfig'") (("'pango-1.0-0'")
(format #f "'~a/lib/libfontconfig.so'" fontconfig)) (format #f "~s"
(("'pangoft2-1.0'") (search-input-file inputs "lib/libpango-1.0.so")))
(format #f "'~a/lib/libpangoft2-1.0.so'" pango))) (("'harfbuzz'")
(substitute* "weasyprint/text.py" (format #f "~s"
(("'gobject-2.0'") (search-input-file inputs "lib/libharfbuzz.so")))
(format #f "'~a/lib/libgobject-2.0.so'" glib)) (("'fontconfig-1'")
(("'pango-1.0'") (format #f "~s"
(format #f "'~a/lib/libpango-1.0.so'" pango)) (search-input-file inputs "lib/libfontconfig.so")))
(("'pangocairo-1.0'") (("'pangoft2-1.0-0'")
(format #f "'~a/lib/libpangocairo-1.0.so'" pango))) (format #f "~s"
#t))) (search-input-file inputs
(add-after 'unpack 'disable-linters "lib/libpangoft2-1.0.so"))))))
;; Their check fails; none of our business. ;; XXX: PEP 517 manual build copied from python-isort.
(lambda _ (replace 'build
(substitute* "setup.cfg" (lambda _
((".*pytest-flake8.*") "") (invoke "python" "-m" "build" "--wheel" "--no-isolation" ".")))
((".*pytest-isort.*") "") (replace 'check
(("--flake8") "") (lambda* (#:key tests? #:allow-other-keys)
(("--isort") "")) (when tests?
#t)) (invoke "pytest" "-vv" "-c" "/dev/null"
(add-before 'check 'register-dejavu-font "-n" (number->string (parallel-job-count))))))
(lambda* (#:key inputs #:allow-other-keys) (replace 'install
;; TODO: fix FreeType so that fonts found in XDG_DATA_DIRS are (lambda _
;; honored. (let ((whl (car (find-files "dist" "\\.whl$"))))
(let* ((HOME "/tmp") (invoke "pip" "--no-cache-dir" "--no-input"
(dejavu (assoc-ref inputs "font-dejavu")) "install" "--no-deps" "--prefix" #$output whl)))))))
(fonts-dir (string-append HOME "/.fonts"))) (inputs (list fontconfig glib harfbuzz pango))
(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)))
(propagated-inputs (propagated-inputs
(list gdk-pixbuf (list gdk-pixbuf
python-cairocffi python-cairocffi
python-cairosvg python-cairosvg
python-cffi python-cffi
python-cssselect2 python-cssselect2
python-fonttools-full
python-html5lib python-html5lib
python-pillow
python-pydyf
python-pyphen python-pyphen
python-tinycss2)) python-tinycss2))
(native-inputs (native-inputs
(list font-dejavu ;tests depend on it (list font-dejavu ;tests depend on it
python-pytest-cov python-pytest-runner)) ghostscript
python-flit-core
python-pypa-build
python-pytest
python-pytest-xdist))
(home-page "https://weasyprint.org/") (home-page "https://weasyprint.org/")
(synopsis "Document factory for creating PDF files from HTML") (synopsis "Document factory for creating PDF files from HTML")
(description "WeasyPrint helps web developers to create PDF documents. It (description "WeasyPrint helps web developers to create PDF documents. It