From 748b53d5a9ce9fc7dcb5d65c39a17bf87aa0208b Mon Sep 17 00:00:00 2001
From: Steffen Hauf <haufs@max-exfl015.desy.de>
Date: Fri, 22 Jun 2018 14:48:38 +0200
Subject: [PATCH] Add pandoc installation

---
 docs/source/conf.py | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/docs/source/conf.py b/docs/source/conf.py
index e07aa0972..5514a507c 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -347,25 +347,30 @@ texinfo_documents = [
 # Example configuration for intersphinx: refer to the Python standard library.
 intersphinx_mapping = {'https://docs.python.org/': None}
 
-# generate the list of available notebooks
-from xfel_calibrate import notebooks
-from subprocess import check_output
-from textwrap import dedent, indent
-from nbconvert import RSTExporter
-import os
-import nbformat
-rst_exporter = RSTExporter()
+
 
 # first install pandoc if necessary
 try:
-    import pypandoc
+    from nbconvert.utils.pandoc import check_pandoc_version
+    check_pandoc_version()
+    print("Pandoc was found!")
 except:
+    print("Installing Pandoc!")
     from subprocess import check_call
     pandoc_url = "https://github.com/jgm/pandoc/releases/download/2.2.1/pandoc-2.2.1-1-amd64.deb"
     pandoc_pack = "pandoc-2.2.1-1-amd64.deb"
     check_call(["wget", pandoc_url])
     check_call(["dpkg", "-i", pandoc_pack])
 
+# generate the list of available notebooks
+from xfel_calibrate import notebooks
+from subprocess import check_output
+from textwrap import dedent, indent
+from nbconvert import RSTExporter
+import os
+import nbformat
+rst_exporter = RSTExporter()
+    
 with open("available_notebooks.rst", "w") as f:
     f.write(dedent("""
             .. _available_notebooks:
-- 
GitLab