[bug#34204,3/3] gnu: Add Mkdocs.

Message ID 20190126002849.7707-3-mthl@gnu.org
State Accepted
Headers show
Series Mkdocs and its dependencies | expand

Checks

Context Check Description
cbaines/applying patch success Successfully applied

Commit Message

Mathieu Lirzin Jan. 26, 2019, 12:28 a.m. UTC
* gnu/packages/documentation.scm (mkdocs): New variable.
---
 gnu/packages/documentation.scm | 35 ++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

Comments

Ricardo Wurmus Jan. 26, 2019, 1:37 p.m. UTC | #1
Hi Mathieu,

> * gnu/packages/documentation.scm (mkdocs): New variable.
[…]
> +
> +(define-public mkdocs
> +  (package
> +    (name "mkdocs")
> +    (version "1.0.4")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (pypi-uri "mkdocs" version))
> +       (sha256
> +        (base32
> +         "0fg9w6rdskwnn7knri7xzrd26k9svwqlxvdr0kk5spfpm8ll7lqp"))))
> +    (build-system python-build-system)
> +    (arguments
> +     ;; XXX: Tests are failing.
> +     ;; AttributeError: module 'mkdocs.plugins' has no attribute 'get_plugins'
> +     '(#:tests? #f))

Hmm, any idea why this happens?  Are the plugins not included?  Is there
an upstream bug report about this?

Other than that it looks good to me.
Mathieu Lirzin Jan. 26, 2019, 3:24 p.m. UTC | #2
Hello Ricardo,

Ricardo Wurmus <rekado@elephly.net> writes:

>> * gnu/packages/documentation.scm (mkdocs): New variable.
> […]
>> +
>> +(define-public mkdocs
>> +  (package
>> +    (name "mkdocs")
>> +    (version "1.0.4")
>> +    (source
>> +     (origin
>> +       (method url-fetch)
>> +       (uri (pypi-uri "mkdocs" version))
>> +       (sha256
>> +        (base32
>> +         "0fg9w6rdskwnn7knri7xzrd26k9svwqlxvdr0kk5spfpm8ll7lqp"))))
>> +    (build-system python-build-system)
>> +    (arguments
>> +     ;; XXX: Tests are failing.
>> +     ;; AttributeError: module 'mkdocs.plugins' has no attribute 'get_plugins'
>> +     '(#:tests? #f))
>
> Hmm, any idea why this happens?  Are the plugins not included?  Is there
> an upstream bug report about this?

I didn't dig much, but after some search I have found the Nix package
definition [1] and it seems that the test suite requires ‘nosetests’ and
excludes 3 tests needs to be excluded to make the test suite pass.

Without worrying about how to exclude tests for now, I tried to add the
following to the ‘mkdocs’ package definition:

    (arguments '(#:test-target "nosetests"))
    (native-inputs
     `(("python-mock" ,python-mock)
       ("python-nose" ,python-nose)))

I get errors like the following:

--8<---------------cut here---------------start------------->8---
AssertionError: ([('docs_dir', ValidationError("The path /tmp/guix-build-mkdocs-1.0.4.drv-0/mkdocs-1.0.4/mkdocs/tests/integration/minimal/docs isn't an existing directory."))], [])
--8<---------------cut here---------------end--------------->8---

Any idea how to fix this kind of issue?

You can take a look at the attached build log for more details.

Thanks
[1] https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/documentation/mkdocs/default.nix

Patch

diff --git a/gnu/packages/documentation.scm b/gnu/packages/documentation.scm
index 9425df707c..2eb1f29013 100644
--- a/gnu/packages/documentation.scm
+++ b/gnu/packages/documentation.scm
@@ -7,6 +7,7 @@ 
 ;;; Copyright © 2017 Kei Kebreau <kkebreau@posteo.net>
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Mathieu Lirzin <mthl@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -29,10 +30,13 @@ 
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system python)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-web)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages flex)
@@ -219,3 +223,34 @@  sort, and search the document catalog.  It will also be able to communicate
 with catalog servers on the Net to search for documents which are not on the
 local system.")
     (license lgpl2.1+)))
+
+(define-public mkdocs
+  (package
+    (name "mkdocs")
+    (version "1.0.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "mkdocs" version))
+       (sha256
+        (base32
+         "0fg9w6rdskwnn7knri7xzrd26k9svwqlxvdr0kk5spfpm8ll7lqp"))))
+    (build-system python-build-system)
+    (arguments
+     ;; XXX: Tests are failing.
+     ;; AttributeError: module 'mkdocs.plugins' has no attribute 'get_plugins'
+     '(#:tests? #f))
+    (propagated-inputs
+     `(("python-click" ,python-click)
+       ("python-jinja2" ,python-jinja2)
+       ("python-livereload" ,python-livereload)
+       ("python-markdown" ,python-markdown)
+       ("python-pyyaml" ,python-pyyaml)
+       ("python-tornado" ,python-tornado)))
+    (home-page "https://www.mkdocs.org")
+    (synopsis "Project documentation with Markdown")
+    (description
+     "This is a fast and simple static site generator that's geared towards
+building project documentation.  Documentation source files are written in
+Markdown, and configured with a single YAML configuration file.")
+    (license bsd-3)))