From 44a8eeebe5eabe3c2f43d4b1dea0908f1eb44d90 Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Mon, 7 Oct 2019 14:56:50 +0200 Subject: [PATCH] python-oneviewclient: Switch to python3 Change-Id: I4dd5a2d7281a16f5dd693154ff3a7726563c02bf --- ...rom-oslosphinx-to-openstackdocstheme.patch | 76 +++++++++++++++++++ .../python-oneviewclient.spec.j2 | 63 ++++++++------- 2 files changed, 111 insertions(+), 28 deletions(-) create mode 100644 openstack/python-oneviewclient/0001-Switch-from-oslosphinx-to-openstackdocstheme.patch diff --git a/openstack/python-oneviewclient/0001-Switch-from-oslosphinx-to-openstackdocstheme.patch b/openstack/python-oneviewclient/0001-Switch-from-oslosphinx-to-openstackdocstheme.patch new file mode 100644 index 000000000..0ebfb8173 --- /dev/null +++ b/openstack/python-oneviewclient/0001-Switch-from-oslosphinx-to-openstackdocstheme.patch @@ -0,0 +1,76 @@ +From c110bc50d1a5d1997124a70af1102cc1ca1718d1 Mon Sep 17 00:00:00 2001 +From: Thomas Bechtold +Date: Mon, 7 Oct 2019 14:52:47 +0200 +Subject: [PATCH] Switch from oslosphinx to openstackdocstheme + +That's what the OpenStack community is using today. Also with newer +Sphinx versions, the current approach does no longer build. + +Change-Id: Id2b82af22bd159be7f006ac0ffec870dfa30858e +--- + doc/source/conf.py | 6 +++++- + test-requirements.txt | 5 +++-- + tox.ini | 3 ++- + 3 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/doc/source/conf.py b/doc/source/conf.py +index e46b33b..19b4dee 100755 +--- a/doc/source/conf.py ++++ b/doc/source/conf.py +@@ -23,7 +23,7 @@ sys.path.insert(0, os.path.abspath('../..')) + extensions = [ + 'sphinx.ext.autodoc', + #'sphinx.ext.intersphinx', +- 'oslosphinx' ++ 'openstackdocstheme' + ] + + # autodoc generation is a bit aggressive and a nuisance when doing heavy +@@ -57,6 +57,7 @@ pygments_style = 'sphinx' + # html_theme_path = ["."] + # html_theme = '_theme' + # html_static_path = ['static'] ++html_theme = 'openstackdocs' + + # Output file base name for HTML help builder. + htmlhelp_basename = '%sdoc' % project +@@ -73,3 +74,6 @@ latex_documents = [ + + # Example configuration for intersphinx: refer to the Python standard library. + #intersphinx_mapping = {'http://docs.python.org/': None} ++ ++# openstackdocstheme options ++repository_name = 'openstack/python-oneviewclient' +diff --git a/test-requirements.txt b/test-requirements.txt +index cba4926..419849f 100644 +--- a/test-requirements.txt ++++ b/test-requirements.txt +@@ -6,8 +6,9 @@ hacking<0.11,>=0.10.0 + + coverage!=4.4,>=4.0 # Apache-2.0 + python-subunit>=0.0.18 # Apache-2.0/BSD +-sphinx!=1.6.1,>=1.5.1 # BSD +-oslosphinx>=4.7.0 # Apache-2.0 ++sphinx!=1.6.6,!=1.6.7,<2.0.0;python_version=='2.7' # BSD ++sphinx!=1.6.6,!=1.6.7,!=2.1.0;python_version>='3.4' # BSD ++openstackdocstheme # Apache-2.0 + oslotest>=1.10.0 # Apache-2.0 + testrepository>=0.0.18 # Apache-2.0/BSD + testscenarios>=0.4 # Apache-2.0/BSD +diff --git a/tox.ini b/tox.ini +index 80f8efb..291bfed 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -21,7 +21,8 @@ commands = {posargs} + commands = python setup.py test --coverage --testr-args='{posargs}' + + [testenv:docs] +-commands = python setup.py build_sphinx ++commands = ++ sphinx-build -b html doc/source doc/build/html + + [testenv:debug] + commands = oslo_debug_helper {posargs} +-- +2.23.0 + diff --git a/openstack/python-oneviewclient/python-oneviewclient.spec.j2 b/openstack/python-oneviewclient/python-oneviewclient.spec.j2 index 33bbf985b..bc1ed9b77 100644 --- a/openstack/python-oneviewclient/python-oneviewclient.spec.j2 +++ b/openstack/python-oneviewclient/python-oneviewclient.spec.j2 @@ -1,26 +1,33 @@ -Name: {{ py2name('python-oneviewclient') }} -Version: 2.6.6 -Release: 0 +{% set pypi_name = 'python-oneviewclient' %} +{% set upstream_version = upstream_version('2.6.6') %} +{% set rpm_release = '1' %} +{% set source = url_pypi() %} + +Name: {{ py2name() }} +Version: {{ py2rpmversion() }} +Release: {{ py2rpmrelease() }} Summary: Python API and CLI for OpenStack Oneview License: {{ license('Apache-2.0') }} Group: Development/Languages/Python URL: https://launchpad.net/%{name} -Source0: https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz +Source0: {{ source }} +# https://review.opendev.org/687019 +Patch0: 0001-Switch-from-oslosphinx-to-openstackdocstheme.patch BuildRequires: openstack-macros -BuildRequires: {{ py2pkg('mock') }} -BuildRequires: {{ py2pkg('oslo.serialization') }} -BuildRequires: {{ py2pkg('pbr') }} -BuildRequires: {{ py2pkg('python-subunit') }} -BuildRequires: {{ py2pkg('retrying') }} -BuildRequires: {{ py2pkg('setuptools') }} -BuildRequires: {{ py2pkg('testrepository') }} -BuildRequires: {{ py2pkg('testscenarios') }} -BuildRequires: {{ py2pkg('testtools') }} -Requires: {{ py2pkg('Babel') }} -Requires: {{ py2pkg('pbr') }} -Requires: {{ py2pkg('retrying') }} -Requires: {{ py2pkg('six') }} -Requires: {{ py2pkg('stevedore') }} +BuildRequires: {{ py3('mock') }} +BuildRequires: {{ py3('oslo.serialization') }} +BuildRequires: {{ py3('pbr') }} +BuildRequires: {{ py3('python-subunit') }} +BuildRequires: {{ py3('retrying') }} +BuildRequires: {{ py3('setuptools') }} +BuildRequires: {{ py3('testrepository') }} +BuildRequires: {{ py3('testscenarios') }} +BuildRequires: {{ py3('testtools') }} +Requires: {{ py3('Babel') }} +Requires: {{ py3('pbr') }} +Requires: {{ py3('retrying') }} +Requires: {{ py3('six') }} +Requires: {{ py3('stevedore') }} BuildArch: noarch %description @@ -30,8 +37,8 @@ Client library for Oneview built on the Oneview API. It provides a Python API %package doc Summary: Documentation for OpenStack Oneview API client libary Group: Documentation/HTML -BuildRequires: {{ py2pkg('Sphinx') }} -BuildRequires: {{ py2pkg('oslosphinx') }} +BuildRequires: {{ py3('Sphinx') }} +BuildRequires: {{ py3('openstackdocstheme') }} %description doc Client library for Oneview built on the Oneview API. It provides a Python API @@ -39,27 +46,27 @@ Client library for Oneview built on the Oneview API. It provides a Python API This package contains the documentation. %prep -%autosetup -n %{name}-%{version} +%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }} %py_req_cleanup %build -%py2_build +%py3_build # Build HTML docs and man page -%{__python2} setup.py build_sphinx -rm -rf html/.{doctrees,buildinfo} +PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html +rm -rf doc/build/html/.{doctrees,buildinfo} %install -%py2_install +%py3_install %check -%{__python2} setup.py testr +PYTHON=%{__python3} %{__python3} setup.py test %files %doc README.rst %license LICENSE -%{python2_sitelib}/oneview_client -%{python2_sitelib}/*.egg-info +%{python3_sitelib}/oneview_client +%{python3_sitelib}/*.egg-info %files doc %doc doc/build/html