From 89acbaa8577f3eb423ce6a6741da79cff110d837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Ljungstr=C3=B6m?= <ml@mljx.io> Date: Tue, 9 Apr 2019 13:52:14 +0200 Subject: [PATCH] added make_docs.py for win10 documentation generation --- AUTHORS.rst | 1 + README.rst | 11 ++++++++++- make_docs.py | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 make_docs.py diff --git a/AUTHORS.rst b/AUTHORS.rst index 04b5015c..461cefa5 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -11,6 +11,7 @@ Development * A Egli <adrian.egli@sbb.ch> +* Mattias Ljungström <ml@mljx.io> Contributors ------------ diff --git a/README.rst b/README.rst index f285d1f4..a105fc67 100644 --- a/README.rst +++ b/README.rst @@ -21,12 +21,20 @@ Generate Docs | **TODO**: Mohanty to add atleast a neat outline herefor the contents to the docs here. .. code-block:: bash - + Linux and macOS setup git clone git@gitlab.aicrowd.com:flatland/flatland.git cd flatland pip install -r requirements_dev.txt make docs + Windows Setup + git clone git@gitlab.aicrowd.com:flatland/flatland.git + cd flatland + pip install -r requirements_dev.txt + python setup.py develop + python make_docs.py + + Features -------- @@ -36,4 +44,5 @@ Authors -------- * Sharada Mohanty <mohanty@aicrowd.com> * Giacomo Spigler <giacomo.spigler@gmail.com> +* Mattias Ljungström <ml@mljx.io> <please fill yourself in> \ No newline at end of file diff --git a/make_docs.py b/make_docs.py new file mode 100644 index 00000000..909a0d99 --- /dev/null +++ b/make_docs.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +import os +import webbrowser +import subprocess + +def browser(pathname): + try: + from urllib import pathname2url + except: + from urllib.request import pathname2url + webbrowser.open("file:" + pathname2url(pathname)) + +def remove_exists(filename): + try: + os.remove(filename) + except FileNotFoundError: + pass + + +# clean docs config and html files, and rebuild everything +remove_exists('docs/flatland.rst') +remove_exists('docs/modules.rst') + +subprocess.call('sphinx-apidoc -o docs/ flatland') + +os.environ["SPHINXPROJ"] = "flatland" +os.chdir('docs') +subprocess.call('python -msphinx -M clean . _build') +subprocess.call('python -msphinx -M html . _build') + +browser(os.path.abspath('_build/html/index.html')) -- GitLab