From 8e21d5ee996f0a57879bedf0f9c74e8847297aa9 Mon Sep 17 00:00:00 2001 From: "David B. Kinder" Date: Mon, 1 Oct 2018 14:25:21 -0700 Subject: [PATCH] doc: update genrest script for latest kconfiglib The genrest.py script (used to generate config documentation from the Kconfig files) broke when upgrading to the latest kconfiglib (10.9.1). Copied the latest genrest.py script from the Zephyr project (where this script and processing was developed) and things work again. Update Makefile's call to genrest.py (toplevel Kconfig path is now found relative to the srctree. Update requirements.txt to match the kconfiglib version family verified to work. fixes: #1387 Signed-off-by: David B. Kinder Documentation scripts: enhance 'show-versions.py' Modify the doc/scripts/show-versions.py script by making it gather the list of Python modules to check the version for from the "requirements.txt" file. It should help keep this in sync if/when our requirements evolve. Signed-off-by: Geoffroy Van Cutsem --- doc/Makefile | 2 +- doc/scripts/requirements.txt | 2 +- doc/scripts/show-versions.py | 43 +++++++++++++++++++++++++++--------- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index e9154959a..f3ab84302 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -46,7 +46,7 @@ content: kconfig: $(Q)srctree=../hypervisor \ - python3 scripts/genrest.py ../hypervisor/Kconfig reference/kconfig/ + python3 scripts/genrest.py Kconfig reference/kconfig/ pullsource: $(Q)scripts/pullsource.sh diff --git a/doc/scripts/requirements.txt b/doc/scripts/requirements.txt index 0dedb0a9d..f81305ff0 100644 --- a/doc/scripts/requirements.txt +++ b/doc/scripts/requirements.txt @@ -2,4 +2,4 @@ breathe==4.9.1 sphinx==1.7.7 docutils==0.14 sphinx_rtd_theme==0.4.0 -kconfiglib==10.9.1 +kconfiglib==10.* diff --git a/doc/scripts/show-versions.py b/doc/scripts/show-versions.py index 45baf9544..d6730dc6d 100755 --- a/doc/scripts/show-versions.py +++ b/doc/scripts/show-versions.py @@ -6,15 +6,38 @@ # # Show installed versions of doc building tools +import os.path +import sys +import pkg_resources import subprocess -print ("breathe version: " + - __import__("breathe").__version__ + "\n" + - "docutils version: " + - __import__("docutils").__version__ + "\n" + - "sphinx version: " + - __import__("sphinx").__version__ + "\n" + - "sphinx_rtd_theme version: " + - __import__("sphinx_rtd_theme").__version__ + "\n" + - "doxygen version: " + - subprocess.check_output(["doxygen", "-v"]).decode("utf-8")) +class color: + PURPLE = '\033[95m' + CYAN = '\033[96m' + DARKCYAN = '\033[36m' + BLUE = '\033[94m' + GREEN = '\033[92m' + YELLOW = '\033[93m' + RED = '\033[91m' + BOLD = '\033[1m' + UNDERLINE = '\033[4m' + END = '\033[0m' + +# Check all requirements listed in requirements.txt and print out version installed (if any) +print ("Listing versions of doc build dependencies found on your system...\n") + +rf = open(os.path.join(sys.path[0], "requirements.txt"),"r") + +for reqs in pkg_resources.parse_requirements(rf): + try: + ver = pkg_resources.get_distribution(reqs.project_name).version + print (" " + reqs.project_name.ljust(25," ") + " version: " + ver) + except: + print (color.RED + color.BOLD + reqs.project_name + " is missing." + color.END + + " (Hint: install all dependencies with " + color.YELLOW + + "\"pip3 install --user -r requirements.txt\"" + color.END + ")") + +rf.close() + +# Print out the version of Doxygen (not installed via pip3) +print (" " + "doxygen".ljust(25," ") + " version: " + subprocess.check_output(["doxygen", "-v"]).decode("utf-8"))