summary refs log tree commit diff
path: root/gnu/packages/fontutils.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-04-01 15:28:00 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-05-12 12:45:24 -0400
commit9e29cf8d73c39fa65a9d4a107b5db614cb88062a (patch)
treed19da0bcca749875b79919b001d3c7a11b06a938 /gnu/packages/fontutils.scm
parent8907dcce772bb6a38ed520bce25dc9f55b3c3b01 (diff)
downloadguix-9e29cf8d73c39fa65a9d4a107b5db614cb88062a.tar.gz
gnu: Add python-opentype-sanitizer.
* gnu/packages/fontutils.scm (python-opentype-sanitizer): New variable.
Diffstat (limited to 'gnu/packages/fontutils.scm')
-rw-r--r--gnu/packages/fontutils.scm37
1 files changed, 37 insertions, 0 deletions
diff --git a/gnu/packages/fontutils.scm b/gnu/packages/fontutils.scm
index 16c2391179..ec6dab37ff 100644
--- a/gnu/packages/fontutils.scm
+++ b/gnu/packages/fontutils.scm
@@ -131,6 +131,43 @@ files (OTF, TTF) and WOFF and WOFF2 font files, validating them and sanitizing
 them as it goes.")
     (license license:bsd-3)))
 
+(define-public python-opentype-sanitizer
+  (package
+    (name "python-opentype-sanitizer")
+    (version "8.2.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "opentype-sanitizer" version))
+       (sha256
+        (base32 "1wjy6chbnj9ic5yjxal6spln5jfzr8cigqs6ab0gj7q60dndrl5k"))))
+    (build-system python-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'unbundle-opentype-sanitizer
+            (lambda* (#:key inputs #:allow-other-keys)
+              (delete-file-recursively "src/c")
+              (substitute* "setup.py"
+                (("^cmdclass\\[\"download\"].*") "")
+                (("^cmdclass\\[\"build_ext\"].*") "")
+                (("^cmdclass\\[\"egg_info\"].*") ""))
+              (substitute* "src/python/ots/__init__.py"
+                (("^OTS_SANITIZE = .*")
+                 (format #f "OTS_SANITIZE = ~s~%"
+                         (search-input-file inputs "bin/ots-sanitize"))))))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "pytest" "-vv")))))))
+    (native-inputs (list python-pytest python-setuptools-scm))
+    (inputs (list opentype-sanitizer))
+    (home-page "https://github.com/googlefonts/ots-python")
+    (synopsis "Python wrapper for OpenType Sanitizer")
+    (description "Python wrapper for the OpenType Sanitizer library.")
+    (license license:bsd-3)))
+
 (define-public ttfautohint
   (package
     (name "ttfautohint")