diff options
author | Marius Bakke <marius@gnu.org> | 2022-01-11 23:31:34 +0100 |
---|---|---|
committer | Marius Bakke <marius@gnu.org> | 2022-01-12 23:50:14 +0100 |
commit | 789ef87470628e3188111cd7f6c01674a2edeb21 (patch) | |
tree | d3dd15ff62ff53d06a05b2cf6a2d41c0b2adf292 /gnu | |
parent | a16ca6b38113900b28e219478703c37cd0250042 (diff) | |
download | guix-789ef87470628e3188111cd7f6c01674a2edeb21.tar.gz guix-789ef87470628e3188111cd7f6c01674a2edeb21.zip |
gnu: Add python-cmarkgfm.
* gnu/packages/markup.scm (python-cmarkgfm): New variable.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/packages/markup.scm | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm index bc1cb8e73f..b52f3dd361 100644 --- a/gnu/packages/markup.scm +++ b/gnu/packages/markup.scm @@ -36,10 +36,12 @@ #:use-module (guix build-system perl) #:use-module (guix build-system python) #:use-module (guix utils) + #:use-module (guix gexp) + #:use-module (gnu packages) #:use-module (gnu packages base) #:use-module (gnu packages check) #:use-module (gnu packages compression) - #:use-module (gnu packages) + #:use-module (gnu packages libffi) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) @@ -239,6 +241,56 @@ implementation. @end example") (license license:perl-license))) +(define-public python-cmarkgfm + (package + (name "python-cmarkgfm") + (version "0.7.0") + (source (origin + (method url-fetch) + (uri (pypi-uri "cmarkgfm" version)) + (sha256 + (base32 + "06cw49bzxl3k7m8993cyi5zqxvk817z8ghhr9xqq5gx8klpiap56")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Delete bundled cmark and generated headers. + (for-each delete-file-recursively + '("third_party/cmark" "generated")))))) + (build-system python-build-system) + (arguments + (list #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'copy-cmark-gfm + (lambda _ + ;; This package needs the cmark-gfm source files + ;; to generate FFI bindings. + (copy-recursively #+(package-source (this-package-input + "cmark-gfm")) + "third_party/cmark"))) + (add-after 'unpack 'install-cmark-headers + (lambda* (#:key inputs #:allow-other-keys) + ;; XXX: Loosely based on 'regenerate' from noxfile.py. + (let ((version.h (search-input-file + inputs "/include/cmark-gfm_version.h"))) + (for-each (lambda (file) + (install-file file "generated/unix/")) + (cons version.h + (find-files (dirname version.h) + "_export\\.h$")))))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? (invoke "pytest" "-vv" "tests"))))))) + (native-inputs (list python-pytest)) + (inputs (list cmark-gfm)) + (propagated-inputs (list python-cffi-1.15)) + (home-page "https://github.com/theacodes/cmarkgfm") + (synopsis "Python bindings for GitHub's fork of cmark") + (description + "This package provides a minimal set of Python bindings for the +GitHub cmark fork (@code{cmark-gfm}).") + (license license:expat))) + (define-public python-markdownify (package (name "python-markdownify") |