From 8467919e4e27cda004a900082c5084875f04403d Mon Sep 17 00:00:00 2001 From: Paul Vinciguerra Date: Sun, 13 Jan 2019 11:33:52 -0800 Subject: [PATCH] VTL: Fix sphinx doc generation. Remove unnecessary envvar magic for sphinx builds. Just provide the proper mock objects. Change-Id: I151513eb47d2f71cf221651145dbcdc153448772 Signed-off-by: Paul Vinciguerra --- test/Makefile | 2 +- test/doc/conf.py | 10 ++++++---- test/vpp_papi_provider.py | 14 +------------- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/test/Makefile b/test/Makefile index b605428ebc0..8b1370f7a84 100644 --- a/test/Makefile +++ b/test/Makefile @@ -206,7 +206,7 @@ wipe: reset doc: verify-test-dir $(PIP_PATCH_DONE) @virtualenv $(VENV_PATH) -p python3 @bash -c "source $(VENV_PATH)/bin/activate && python3 -m pip install sphinx sphinx-rtd-theme" - @bash -c "source $(VENV_PATH)/bin/activate && make -C doc WS_ROOT=$(WS_ROOT) BR=$(BR) NO_VPP_PAPI=1 html" + @bash -c "source $(VENV_PATH)/bin/activate && make -C doc WS_ROOT=$(WS_ROOT) BR=$(BR) html" .PHONY: wipe-doc diff --git a/test/doc/conf.py b/test/doc/conf.py index ec8958ea2f0..98cd7ab306d 100644 --- a/test/doc/conf.py +++ b/test/doc/conf.py @@ -20,7 +20,6 @@ import os import sys sys.path.insert(0, os.path.abspath('..')) - # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. @@ -33,6 +32,9 @@ sys.path.insert(0, os.path.abspath('..')) extensions = [ 'sphinx.ext.autodoc', ] +autodoc_mock_imports = ['objgraph', + 'pympler', + 'vpp_papi'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -122,7 +124,7 @@ todo_include_todos = False # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -#html_theme = 'alabaster' +# html_theme = 'alabaster' html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme @@ -149,8 +151,8 @@ html_theme = 'sphinx_rtd_theme' # html_logo = None # The name of an image file (relative to this directory) to use as a favicon of -# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. +# the docs. This file should be a Windows icon file (.ico) being 16x16 or +# 32x32 pixels large. # # html_favicon = None diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py index 1ca9a89a2ea..087424cb22f 100644 --- a/test/vpp_papi_provider.py +++ b/test/vpp_papi_provider.py @@ -4,22 +4,10 @@ import time from collections import deque from six import moves -from vpp_papi import mac_pton +from vpp_papi import VPP, mac_pton from hook import Hook from vpp_l2 import L2_PORT_TYPE -# Sphinx creates auto-generated documentation by importing the python source -# files and collecting the docstrings from them. The NO_VPP_PAPI flag allows -# the vpp_papi_provider.py file to be importable without having to build -# the whole vpp api if the user only wishes to generate the test documentation. - -try: - from vpp_papi import VPP -except ImportError: - if not os.getenv("NO_VPP_PAPI") == 1: - raise - pass - # from vnet/vnet/mpls/mpls_types.h MPLS_IETF_MAX_LABEL = 0xfffff MPLS_LABEL_INVALID = MPLS_IETF_MAX_LABEL + 1 -- 2.16.6