From 7931f9818d982523247064427a5ab8461c8a5a11 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Fri, 17 Apr 2020 17:31:14 +0200 Subject: [PATCH] Cleanup py27 support This repo is now testing only with Python 3, so let's make a few cleanups: - Remove obsolete sections from setup.cfg - Use newer openstackdocstheme and Sphinx versions for Python3 - Cleanup */source/conf.py to remove now obsolete content. - Remove install_command from tox.ini, the default is fine - Move python3 to testenv in tox.ini - Switch to hacking 3, fix problems found. Change-Id: I26fcab3b288b5ed64c74f7a6725b43036f195d44 --- doc/source/_exts/atcs.py | 2 +- doc/source/_exts/page_context.py | 2 +- doc/source/_exts/tags.py | 8 ++++---- doc/source/conf.py | 5 ----- setup.cfg | 9 --------- test-requirements.txt | 9 +++------ tools/assign_liaisons.py | 1 + tools/universe_dot.py | 7 ++++--- tox.ini | 11 +++-------- 9 files changed, 17 insertions(+), 37 deletions(-) diff --git a/doc/source/_exts/atcs.py b/doc/source/_exts/atcs.py index d8621207c..0c72e2525 100644 --- a/doc/source/_exts/atcs.py +++ b/doc/source/_exts/atcs.py @@ -135,7 +135,7 @@ class ExtraATCsTable(tables.Table): return table -_PATTERN = re.compile('(?P.+):\s+(?P.+)\s\((?P.+)\)\s\[(?P.*)\]') +_PATTERN = re.compile(r'(?P.+):\s+(?P.+)\s\((?P.+)\)\s\[(?P.*)\]') def setup(app): diff --git a/doc/source/_exts/page_context.py b/doc/source/_exts/page_context.py index bb16ed992..819833e38 100644 --- a/doc/source/_exts/page_context.py +++ b/doc/source/_exts/page_context.py @@ -41,7 +41,7 @@ def _get_last_updated_file(src_file): try: return datetime.datetime.strptime(last_updated_t, '%Y-%m-%d %H:%M:%S') - except ValueError as err: + except ValueError: LOG.info('[governance] Could not parse modification time of ' '%s: %r', src_file, last_updated_t) diff --git a/doc/source/_exts/tags.py b/doc/source/_exts/tags.py index 13bdea5ac..cfc458098 100644 --- a/doc/source/_exts/tags.py +++ b/doc/source/_exts/tags.py @@ -79,12 +79,12 @@ class TaggedProjectsDirective(rst.Directive): def _build_projects_by_tag(): for proj_name, info in projects.get_project_data().items(): for tag in info.get('tags', []): - l = _projects_by_tag.setdefault(tag, []) - l.append((proj_name, None)) + li = _projects_by_tag.setdefault(tag, []) + li.append((proj_name, None)) for name, deliverable in info.get('deliverables', {}).items(): for tag in deliverable.get('tags', []): - l = _projects_by_tag.setdefault(tag, []) - l.append((proj_name, name)) + li = _projects_by_tag.setdefault(tag, []) + li.append((proj_name, name)) def setup(app): diff --git a/doc/source/conf.py b/doc/source/conf.py index 223c30a9a..f3cfa1dc0 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -14,7 +14,6 @@ # flake8: noqa import datetime -import subprocess import sys import os @@ -142,10 +141,6 @@ html_static_path = ['_static'] html_extra_path = ['_extra'] -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -html_last_updated_fmt = '%Y-%m-%d' - # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True diff --git a/setup.cfg b/setup.cfg index b569f516d..53200ec96 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,15 +12,6 @@ home-page = http://www.openstack.org/ packages = openstack_governance -[build_sphinx] -all_files = 1 -build-dir = doc/build -source-dir = doc/source -warning-is-error = 1 - -[pbr] -warnerrors = True - [flake8] ignore = E501,E226,H405 diff --git a/test-requirements.txt b/test-requirements.txt index 9a1ab966c..4d25b539c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,12 +1,12 @@ # needed for doc build docutils>=0.11,!=0.13.1 # OSI-Approved Open Source, Public Domain -openstackdocstheme>=1.25.0 # Apache 2.0 -sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2 +openstackdocstheme>=2.0.0 # Apache 2.0 +sphinx!=2.1.0,>=2.0 PyYAML>=3.1.0 yamllint>=0.5.2 requests-cache Pillow>=2.4.0 # PIL License -hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 +hacking>=3.0,<3.1.0 # Apache-2.0 whereto>=0.3.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD @@ -17,6 +17,3 @@ testtools>=1.4.0 # MIT oslotest>=1.10.0 # Apache-2.0 coverage>=4.0 # Apache-2.0 - -# mocking framework -mock>=2.0 # BSD diff --git a/tools/assign_liaisons.py b/tools/assign_liaisons.py index 9804077ea..1405921b8 100644 --- a/tools/assign_liaisons.py +++ b/tools/assign_liaisons.py @@ -88,5 +88,6 @@ def main(): projects.write_project_file(project_data, args.projects_file) + if __name__ == '__main__': main() diff --git a/tools/universe_dot.py b/tools/universe_dot.py index 437c28f3c..6865ef0f7 100644 --- a/tools/universe_dot.py +++ b/tools/universe_dot.py @@ -41,13 +41,14 @@ Then open os_universe.svg in your favorite web browser. import sys import time +import pydot +import six +import yaml + if len(sys.argv) == 1: print(__doc__.strip()) sys.exit(1) -import pydot -import six -import yaml projects_file = sys.argv[1] output_dot_file = sys.argv[2] diff --git a/tox.ini b/tox.ini index 9b9290c28..30ba10d37 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,12 @@ [tox] envlist = docs,linters -minversion = 1.6 +minversion = 3.1.1 skipsdist = True +ignore_basepython_conflict = True [testenv] usedevelop = True -install_command = pip install -U {opts} {packages} +basepython = python3 setenv = VIRTUAL_ENV={envdir} PYTHON=coverage run --source openstack_governance --parallel-mode @@ -38,28 +39,22 @@ commands = {toxinidir}/tools/validate_repositories.py [testenv:validate_atcs] -basepython = python3 commands = {toxinidir}/tools/validate_atcs.py [testenv:pep8] -basepython = python3 commands = flake8 [testenv:venv] -basepython = python3 commands = {posargs} [testenv:docs] -basepython = python3 commands = sphinx-build -W -b html doc/source doc/build/html [testenv:validate] -basepython = python3 commands = python3 tools/validate_tags.py [testenv:check-review-status] -basepython = python3 deps = requests prettytable