* [bug#37617] [PATCH 2/6] gnu: Add python-tinycss2.
2019-10-04 11:08 ` [bug#37617] [PATCH 1/6] gnu: Add python-pytest-isort Hartmut Goebel
@ 2019-10-04 11:08 ` Hartmut Goebel
2019-10-04 11:08 ` [bug#37617] [PATCH 3/6] gnu: Add python-cssselect2 Hartmut Goebel
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Hartmut Goebel @ 2019-10-04 11:08 UTC (permalink / raw)
To: 37617
* gnu/packages/python-web.scm (python-tinycss2): New variable.
---
gnu/packages/python-web.scm | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index e37ae94e18..576b75175d 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -13,7 +13,7 @@
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2015, 2016, 2017, 2019 Leo Famulari <leo@famulari.name>
-;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2016, 2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; Copyright © 2016, 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2015, 2017 Ben Woodcroft <donttrustben@gmail.com>
;;; Copyright © 2015, 2016 Christopher Allan Webber <cwebber@dustycloud.org>
@@ -62,6 +62,7 @@
#:use-module (gnu packages libffi)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
+ #:use-module (gnu packages python-check)
#:use-module (gnu packages python-crypto)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages sphinx)
@@ -3275,3 +3276,36 @@ library to create slugs from unicode strings while keeping it DRY.")
(description "Generate complex HTML+JS pages with Python")
(license license:expat)))
+(define-public python-tinycss2
+ (package
+ (name "python-tinycss2")
+ (version "1.0.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "tinycss2" version))
+ (sha256
+ (base32 "1kw84y09lggji4krkc58jyhsfj31w8npwhznr7lf19d0zbix09v4"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (replace 'check
+ (lambda _ (invoke "pytest"))))))
+ (propagated-inputs
+ `(("python-webencodings" ,python-webencodings)))
+ (native-inputs
+ `(("python-pytest-flake8" ,python-pytest-flake8)
+ ("python-pytest-isort" ,python-pytest-isort)
+ ("python-pytest-runner" ,python-pytest-runner)))
+ (home-page "https://tinycss2.readthedocs.io/")
+ (synopsis "Low-level CSS parser for Python")
+ (description "@code{tinycss2} can parse strings, return Python objects
+representing tokens and blocks, and generate CSS strings corresponding to
+these objects.
+
+Based on the CSS Syntax Level 3 specification, @code{tinycss2} knows the
+grammar of CSS but doesn’t know specific rules, properties or values supported
+in various CSS modules.")
+ (license license:bsd-3)))
+
--
2.21.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [bug#37617] [PATCH 3/6] gnu: Add python-cssselect2.
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 ` Hartmut Goebel
2019-10-04 11:08 ` [bug#37617] [PATCH 4/6] gnu: Add python-cairosvg Hartmut Goebel
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Hartmut Goebel @ 2019-10-04 11:08 UTC (permalink / raw)
To: 37617
* gnu/packages/python-web.scm (python-cssselect2): New variable.
---
gnu/packages/python-web.scm | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 576b75175d..0946a298a9 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -3309,3 +3309,36 @@ grammar of CSS but doesn’t know specific rules, properties or values supported
in various CSS modules.")
(license license:bsd-3)))
+(define-public python-cssselect2
+ (package
+ (name "python-cssselect2")
+ (version "0.2.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "cssselect2" version))
+ (sha256
+ (base32 "0skymzb4ncrm2zdsy80f53vi0arf776lvbp51hzh4ayp1il5lj3h"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (replace 'check
+ (lambda _ (invoke "pytest"))))))
+ (propagated-inputs
+ `(("python-tinycss2" ,python-tinycss2)))
+ (native-inputs
+ `(("python-pytest-cov" ,python-pytest-cov)
+ ("python-pytest-flake8" ,python-pytest-flake8)
+ ("python-pytest-isort" ,python-pytest-isort)
+ ("python-pytest-runner" ,python-pytest-runner)))
+ (home-page "https://cssselect2.readthedocs.io/")
+ (synopsis "CSS selectors for Python ElementTree")
+ (description "@code{cssselect2} is a straightforward implementation of
+CSS3 Selectors for markup documents (HTML, XML, etc.) that can be read by
+ElementTree-like parsers (including cElementTree, lxml, html5lib, etc.).
+
+Unlike the Python package @code{cssselect}, it does not translate selectors to
+XPath and therefore does not have all the correctness corner cases that are
+hard or impossible to fix in cssselect.")
+ (license license:bsd-3)))
--
2.21.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [bug#37617] [PATCH 4/6] gnu: Add python-cairosvg.
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 ` Hartmut Goebel
2019-10-04 11:08 ` [bug#37617] [PATCH 5/6] gnu: Add python-pyphen Hartmut Goebel
2019-10-04 11:08 ` [bug#37617] [PATCH 6/6] gnu: Add weasyprint Hartmut Goebel
4 siblings, 0 replies; 8+ messages in thread
From: Hartmut Goebel @ 2019-10-04 11:08 UTC (permalink / raw)
To: 37617
* gnu/packages/python-xyz.scm (python-cairosvg): New variable.
---
gnu/packages/python-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 413d68c258..abcd7e7408 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -16474,3 +16474,38 @@ It is the recommended replacement for Python's original
@code{distro} also provides a command-line interface to output the platform
information in various formats.")
(license license:asl2.0)))
+
+(define-public python-cairosvg
+ (package
+ (name "python-cairosvg")
+ (version "2.4.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "CairoSVG" version))
+ (sha256
+ (base32 "1bb7irxbaxxb9ahm3z5wsx1q96mm5gzskc7b6q07h9ikcnb8yrjf"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (replace 'check
+ (lambda _ (invoke "pytest"))))))
+ (propagated-inputs
+ `(("python-cairocffi" ,python-cairocffi)
+ ("python-cssselect2" ,python-cssselect2)
+ ("python-defusedxml" ,python-defusedxml)
+ ("python-pillow" ,python-pillow)
+ ("python-tinycss2" ,python-tinycss2)))
+ (native-inputs
+ `(("python-pytest-flake8" ,python-pytest-flake8)
+ ("python-pytest-isort" ,python-pytest-isort)
+ ("python-pytest-runner" ,python-pytest-runner)))
+ (home-page "https://cairosvg.org/")
+ (synopsis "SVG to PDF/PS/PNG converter based on Cairo")
+ (description "CairoSVG is a SVG converter based on Cairo. It can export
+SVG files to PDF, PostScript and PNG files. The main part of CairoSVG is a
+SVG parser, trying to follow the SVG 1.1 recommendation from the W3C. Once
+parsed, the result is drawn to a Cairo surface that can be exported to
+qvarious formats: PDF, PostScript, PNG and even SVG.")
+ (license license:lgpl3+)))
--
2.21.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [bug#37617] [PATCH 5/6] gnu: Add python-pyphen.
2019-10-04 11:08 ` [bug#37617] [PATCH 1/6] gnu: Add python-pytest-isort Hartmut Goebel
` (2 preceding siblings ...)
2019-10-04 11:08 ` [bug#37617] [PATCH 4/6] gnu: Add python-cairosvg Hartmut Goebel
@ 2019-10-04 11:08 ` Hartmut Goebel
2019-10-04 11:08 ` [bug#37617] [PATCH 6/6] gnu: Add weasyprint Hartmut Goebel
4 siblings, 0 replies; 8+ messages in thread
From: Hartmut Goebel @ 2019-10-04 11:08 UTC (permalink / raw)
To: 37617
* gnu/packages/python-xyz.scm (python-pyphen): New variable.
---
gnu/packages/python-xyz.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index abcd7e7408..c7ffecabbf 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -16509,3 +16509,22 @@ SVG parser, trying to follow the SVG 1.1 recommendation from the W3C. Once
parsed, the result is drawn to a Cairo surface that can be exported to
qvarious formats: PDF, PostScript, PNG and even SVG.")
(license license:lgpl3+)))
+
+(define-public python-pyphen
+ (package
+ (name "python-pyphen")
+ (version "0.9.5")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "Pyphen" version))
+ (sha256
+ (base32 "08c9y69ry9d6m4zalhnalg86lsp9v2j5n1ziw5vxfmiihx83lqrv"))))
+ (build-system python-build-system)
+ ;; TODO: Use the Guix system hyphenation packages hyphen-* rather than the
+ ;; embedded set provided by upstream - like Debian does.
+ (home-page "https://github.com/Kozea/Pyphen")
+ (synopsis "Pure Python module to hyphenate text")
+ (description "Pyphen is a pure Python module to hyphenate text using
+existing Hunspell hyphenation dictionaries.")
+ (license (list license:gpl2 license:lgpl2.1 license:mpl1.1))))
--
2.21.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [bug#37617] [PATCH 6/6] gnu: Add weasyprint.
2019-10-04 11:08 ` [bug#37617] [PATCH 1/6] gnu: Add python-pytest-isort Hartmut Goebel
` (3 preceding siblings ...)
2019-10-04 11:08 ` [bug#37617] [PATCH 5/6] gnu: Add python-pyphen Hartmut Goebel
@ 2019-10-04 11:08 ` Hartmut Goebel
4 siblings, 0 replies; 8+ messages in thread
From: Hartmut Goebel @ 2019-10-04 11:08 UTC (permalink / raw)
To: 37617
* 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
^ permalink raw reply related [flat|nested] 8+ messages in thread