From ca86d4473be919ae5ba859e64c0a0cfa69867e4b Mon Sep 17 00:00:00 2001 From: Trevor Bramwell Date: Wed, 28 Mar 2018 10:27:51 -0700 Subject: [PATCH] Update OPNFV Sphinx Theme When the theme was initially created I was under the assumption the directory the theme lives under needs to match the name. This does not seem to be the case and in fact seems to cause issues with correctly importing and using the theme. Includes formatting updates to the README and linting. Change-Id: I67c834bfe9dc99252159394ecbf136d9a264e0a8 Signed-off-by: Trevor Bramwell (cherry picked from commit bd331b2451a17eaf5ed8f6fc8aa89f0499031c28) --- opnfv-theme/MANIFEST.in | 2 +- opnfv-theme/README.rst | 20 +++++++++++--------- opnfv-theme/setup.py | 18 +++++++++--------- opnfv-theme/sphinx_opnfv_theme/__init__.py | 3 ++- .../sphinx_opnfv_theme/{opnfv => }/layout.html | 0 .../{opnfv => }/my_custom_sidebar.html | 0 .../sphinx_opnfv_theme/{opnfv => }/relations.html | 0 .../{opnfv => }/static/favicon.ico | Bin .../sphinx_opnfv_theme/{opnfv => }/static/logo.png | Bin .../{opnfv => }/static/my-styles.css | 0 .../sphinx_opnfv_theme/{opnfv => }/theme.conf | 0 11 files changed, 23 insertions(+), 20 deletions(-) rename opnfv-theme/sphinx_opnfv_theme/{opnfv => }/layout.html (100%) rename opnfv-theme/sphinx_opnfv_theme/{opnfv => }/my_custom_sidebar.html (100%) rename opnfv-theme/sphinx_opnfv_theme/{opnfv => }/relations.html (100%) rename opnfv-theme/sphinx_opnfv_theme/{opnfv => }/static/favicon.ico (100%) rename opnfv-theme/sphinx_opnfv_theme/{opnfv => }/static/logo.png (100%) rename opnfv-theme/sphinx_opnfv_theme/{opnfv => }/static/my-styles.css (100%) rename opnfv-theme/sphinx_opnfv_theme/{opnfv => }/theme.conf (100%) diff --git a/opnfv-theme/MANIFEST.in b/opnfv-theme/MANIFEST.in index a5886cd20..34bc06617 100644 --- a/opnfv-theme/MANIFEST.in +++ b/opnfv-theme/MANIFEST.in @@ -2,6 +2,6 @@ include *.txt include *.rst recursive-include sphinx_opnfv_theme * -recursive-include sphinx_opnfv_theme/opnfv * +recursive-include sphinx_opnfv_theme/static * global-exclude *.pyc diff --git a/opnfv-theme/README.rst b/opnfv-theme/README.rst index 484a7a793..c307768fb 100644 --- a/opnfv-theme/README.rst +++ b/opnfv-theme/README.rst @@ -12,21 +12,23 @@ Here's how to install the theme from PyPI_ To install and configure the theme do the following. -#. Install the theme from pypi:: +#. Install the theme from pypi: - $ pip install sphinx_opnfv_theme + .. code-block:: bash + + $ pip install sphinx_opnfv_theme #. Configure Sphinx to use the theme: -.. code-block:: python + .. code-block:: python - # conf.py - import sphinx_opnfv_theme + # conf.py + import sphinx_opnfv_theme - # ... + # ... - html_theme = 'opnfv' - html_theme_path = sphinx_opnfv_theme.get_html_theme_path() + html_theme = 'opnfv' + html_theme_path = sphinx_opnfv_theme.get_html_theme_path() Customization ------------- @@ -39,7 +41,7 @@ following options for the bootstrap theme:: html_theme_options = { 'bootswatch_theme': 'journal', - 'navbar_sidebarrel': false, + 'navbar_sidebarrel': False, 'navbar_title': '', } diff --git a/opnfv-theme/setup.py b/opnfv-theme/setup.py index 5375c0940..55f55bc92 100644 --- a/opnfv-theme/setup.py +++ b/opnfv-theme/setup.py @@ -2,29 +2,29 @@ from setuptools import setup, find_packages from sphinx_opnfv_theme import __version__ -with open('README.rst') as f: - readme_text = f.read() setup( name='sphinx_opnfv_theme', description="OPNFV Theme for Sphinx", - long_description=readme_text, + long_description=open('README.rst').read(), url='https://docs.opnfv.org/', author='Trevor Bramwell', author_email='tbramwell@linuxfoundation.org', version=__version__, - entry_points = { + entry_points={ 'sphinx.html_themes': [ 'opnfv = sphinx_opnfv_theme', ] }, packages=find_packages(), - install_requires = [ + install_requires=[ 'sphinx_bootstrap_theme', - 'sphinxcontrib.httpdomain', + 'sphinxcontrib-httpdomain', ], include_package_data=True, - package_data = { - 'sphinx_opnfv_theme': ['opnfv/**',] - }, + package_data={'sphinx_opnfv_theme': [ + 'theme.conf', + 'static/*', + '*.html', + ]}, ) diff --git a/opnfv-theme/sphinx_opnfv_theme/__init__.py b/opnfv-theme/sphinx_opnfv_theme/__init__.py index 007927521..2bf05c3ae 100644 --- a/opnfv-theme/sphinx_opnfv_theme/__init__.py +++ b/opnfv-theme/sphinx_opnfv_theme/__init__.py @@ -2,7 +2,7 @@ from os import path -__version__='0.1.1' +__version__ = '0.2.0' def get_html_theme_path(): @@ -10,6 +10,7 @@ def get_html_theme_path(): local_path = path.abspath(path.dirname(__file__)) return [local_path] + def setup(app): """Required by Sphinx to create the theme.""" app.add_html_theme('opnfv', path.abspath(path.dirname(__file__))) diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/layout.html b/opnfv-theme/sphinx_opnfv_theme/layout.html similarity index 100% rename from opnfv-theme/sphinx_opnfv_theme/opnfv/layout.html rename to opnfv-theme/sphinx_opnfv_theme/layout.html diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/my_custom_sidebar.html b/opnfv-theme/sphinx_opnfv_theme/my_custom_sidebar.html similarity index 100% rename from opnfv-theme/sphinx_opnfv_theme/opnfv/my_custom_sidebar.html rename to opnfv-theme/sphinx_opnfv_theme/my_custom_sidebar.html diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/relations.html b/opnfv-theme/sphinx_opnfv_theme/relations.html similarity index 100% rename from opnfv-theme/sphinx_opnfv_theme/opnfv/relations.html rename to opnfv-theme/sphinx_opnfv_theme/relations.html diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/static/favicon.ico b/opnfv-theme/sphinx_opnfv_theme/static/favicon.ico similarity index 100% rename from opnfv-theme/sphinx_opnfv_theme/opnfv/static/favicon.ico rename to opnfv-theme/sphinx_opnfv_theme/static/favicon.ico diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/static/logo.png b/opnfv-theme/sphinx_opnfv_theme/static/logo.png similarity index 100% rename from opnfv-theme/sphinx_opnfv_theme/opnfv/static/logo.png rename to opnfv-theme/sphinx_opnfv_theme/static/logo.png diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/static/my-styles.css b/opnfv-theme/sphinx_opnfv_theme/static/my-styles.css similarity index 100% rename from opnfv-theme/sphinx_opnfv_theme/opnfv/static/my-styles.css rename to opnfv-theme/sphinx_opnfv_theme/static/my-styles.css diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/theme.conf b/opnfv-theme/sphinx_opnfv_theme/theme.conf similarity index 100% rename from opnfv-theme/sphinx_opnfv_theme/opnfv/theme.conf rename to opnfv-theme/sphinx_opnfv_theme/theme.conf -- 2.16.6