diff --git a/docs/source/conf.py b/docs/source/conf.py index e07aa0972040a6322d14bc6a6dc0dd3610bce1e7..5514a507c98919ee1411ea7125ee0f55fb6461f1 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: