diff options
-rw-r--r-- | .zuul.yaml | 4 | ||||
-rw-r--r-- | doc/requirements.txt | 4 | ||||
-rw-r--r-- | doc/source/conf.py | 17 | ||||
-rw-r--r-- | heat_cfntools/tests/test_cfn_helper.py | 2 | ||||
-rw-r--r-- | heat_cfntools/tests/test_cfn_hup.py | 2 | ||||
-rw-r--r-- | lower-constraints.txt | 6 | ||||
-rw-r--r-- | requirements.txt | 4 | ||||
-rw-r--r-- | setup.cfg | 20 | ||||
-rwxr-xr-x | setup.py | 2 | ||||
-rw-r--r-- | test-requirements.txt | 3 | ||||
-rwxr-xr-x | tools/lintstack.py | 198 | ||||
-rwxr-xr-x | tools/lintstack.sh | 59 | ||||
-rw-r--r-- | tox.ini | 19 |
13 files changed, 22 insertions, 318 deletions
@@ -2,7 +2,5 @@ templates: - check-requirements - openstack-lower-constraints-jobs - - openstack-python-jobs - - openstack-python3-train-jobs + - openstack-python3-wallaby-jobs - publish-openstack-docs-pti - - publish-to-pypi diff --git a/doc/requirements.txt b/doc/requirements.txt index 6f07765..f80adec 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,3 +1,3 @@ -openstackdocstheme>=1.11.0 # Apache-2.0 -sphinx>=1.6.2 # BSD +openstackdocstheme>=2.2.1 # Apache-2.0 +sphinx>=2.0.0,!=2.1.0 # BSD sphinxcontrib-httpdomain>=1.7.0 diff --git a/doc/source/conf.py b/doc/source/conf.py index fa24424..764df86 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -60,15 +60,6 @@ master_doc = 'index' project = 'heat-cfntools' copyright = 'OpenStack Foundation' -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = '' -# The full version, including alpha/beta/rc tags. -release = '' - # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # @@ -82,7 +73,7 @@ language = None exclude_patterns = [] # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = 'native' # If true, `todo` and `todoList` produce output, else they produce nothing. # todo_include_todos = False @@ -114,9 +105,9 @@ html_theme = 'openstackdocs' # html_sidebars = {} # -- Options for openstackdocstheme -------------------------------------- -repository_name = 'openstack/heat-cfntools' -bug_project = '991' -bug_tag = 'docs' +openstackdocs_repo_name = 'openstack/heat-cfntools' +openstackdocs_auto_name = False +openstackdocs_use_storyboard = True # -- Options for HTMLHelp output ------------------------------------------ diff --git a/heat_cfntools/tests/test_cfn_helper.py b/heat_cfntools/tests/test_cfn_helper.py index 0255376..962855e 100644 --- a/heat_cfntools/tests/test_cfn_helper.py +++ b/heat_cfntools/tests/test_cfn_helper.py @@ -17,10 +17,10 @@ import json import os import tempfile +from unittest import mock import boto.cloudformation as cfn import fixtures -import mock import testtools import testtools.matchers as ttm diff --git a/heat_cfntools/tests/test_cfn_hup.py b/heat_cfntools/tests/test_cfn_hup.py index b182f92..7a978b3 100644 --- a/heat_cfntools/tests/test_cfn_hup.py +++ b/heat_cfntools/tests/test_cfn_hup.py @@ -14,9 +14,9 @@ # under the License. import tempfile +from unittest import mock import fixtures -import mock import testtools from heat_cfntools.cfntools import cfn_helper diff --git a/lower-constraints.txt b/lower-constraints.txt index 260b010..37b8138 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -1,7 +1,5 @@ -boto==2.13.3 -hacking==0.9.0 -mock==1.0 -pbr==0.8 +boto==2.32.1 +pbr==2.0.0 psutil==1.1.1 six==1.9.0 stestr==2.0.0 diff --git a/requirements.txt b/requirements.txt index a2d74fe..58e361b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pbr!=2.1.0,>=0.8 -boto>=2.13.3 +pbr!=2.1.0,>=2.0.0 +boto>=2.32.1 psutil>=1.1.1 six>=1.9.0 @@ -4,8 +4,9 @@ summary = Tools required to be installed on Heat provisioned cloud instances description-file = README.rst author = OpenStack -author-email = openstack-dev@lists.openstack.org +author-email = openstack-discuss@lists.openstack.org home-page = http://www.openstack.org/ +python-requires = >=3.6 classifier = Environment :: OpenStack Intended Audience :: Information Technology @@ -13,8 +14,6 @@ classifier = License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 @@ -29,18 +28,3 @@ scripts = bin/cfn-init bin/cfn-push-stats bin/cfn-signal - -[global] -setup-hooks = - pbr.hooks.setup_hook - -[wheel] -universal = 1 - -[build_sphinx] -source-dir = doc/source -build-dir = doc/build -all_files = 1 - -[upload_sphinx] -upload-dir = doc/build/html @@ -18,5 +18,5 @@ import setuptools setuptools.setup( - setup_requires=['pbr'], + setup_requires=['pbr>=2.0.0'], pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt index 4550481..4a070b2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,3 @@ -hacking>=0.9.0 -mock>=1.0 +hacking>=3.0.1,<3.1.0 # Apache-2.0 stestr>=2.0.0 testtools>=0.9.34 diff --git a/tools/lintstack.py b/tools/lintstack.py deleted file mode 100755 index 5754637..0000000 --- a/tools/lintstack.py +++ /dev/null @@ -1,198 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2012, AT&T Labs, Yun Mao <yunmao@gmail.com> -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -"""pylint error checking.""" - -import cStringIO as StringIO -import json -import re -import sys - -from pylint import lint -from pylint.reporters import text - -# Note(maoy): E1103 is error code related to partial type inference -ignore_codes = ["E1103"] -# Note(maoy): the error message is the pattern of E0202. It should be ignored -# for nova.tests modules -ignore_messages = ["An attribute affected in nova.tests"] -# Note(maoy): we ignore all errors in openstack.common because it should be -# checked elsewhere. We also ignore nova.tests for now due to high false -# positive rate. -ignore_modules = ["nova/openstack/common/", "nova/tests/"] - -KNOWN_PYLINT_EXCEPTIONS_FILE = "tools/pylint_exceptions" - - -class LintOutput(object): - - _cached_filename = None - _cached_content = None - - def __init__(self, filename, lineno, line_content, code, message, - lintoutput): - self.filename = filename - self.lineno = lineno - self.line_content = line_content - self.code = code - self.message = message - self.lintoutput = lintoutput - - @classmethod - def from_line(cls, line): - m = re.search(r"(\S+):(\d+): \[(\S+)(, \S+)?] (.*)", line) - matched = m.groups() - filename, lineno, code, message = (matched[0], int(matched[1]), - matched[2], matched[-1]) - if cls._cached_filename != filename: - with open(filename) as f: - cls._cached_content = list(f.readlines()) - cls._cached_filename = filename - line_content = cls._cached_content[lineno - 1].rstrip() - return cls(filename, lineno, line_content, code, message, - line.rstrip()) - - @classmethod - def from_msg_to_dict(cls, msg): - """From the output of pylint msg, to a dict, where each key - is a unique error identifier, value is a list of LintOutput - """ - result = {} - for line in msg.splitlines(): - obj = cls.from_line(line) - if obj.is_ignored(): - continue - key = obj.key() - if key not in result: - result[key] = [] - result[key].append(obj) - return result - - def is_ignored(self): - if self.code in ignore_codes: - return True - if any(self.filename.startswith(name) for name in ignore_modules): - return True - if any(msg in self.message for msg in ignore_messages): - return True - return False - - def key(self): - if self.code in ["E1101", "E1103"]: - # These two types of errors are like Foo class has no member bar. - # We discard the source code so that the error will be ignored - # next time another Foo.bar is encountered. - return self.message, "" - return self.message, self.line_content.strip() - - def json(self): - return json.dumps(self.__dict__) - - def review_str(self): - return ("File %(filename)s\nLine %(lineno)d:%(line_content)s\n" - "%(code)s: %(message)s" % self.__dict__) - - -class ErrorKeys(object): - - @classmethod - def print_json(cls, errors, output=sys.stdout): - print >>output, "# automatically generated by tools/lintstack.py" - for i in sorted(errors.keys()): - print >>output, json.dumps(i) - - @classmethod - def from_file(cls, filename): - keys = set() - for line in open(filename): - if line and line[0] != "#": - d = json.loads(line) - keys.add(tuple(d)) - return keys - - -def run_pylint(): - buff = StringIO.StringIO() - reporter = text.ParseableTextReporter(output=buff) - args = ["--include-ids=y", "-E", "nova"] - lint.Run(args, reporter=reporter, exit=False) - val = buff.getvalue() - buff.close() - return val - - -def generate_error_keys(msg=None): - print "Generating", KNOWN_PYLINT_EXCEPTIONS_FILE - if msg is None: - msg = run_pylint() - errors = LintOutput.from_msg_to_dict(msg) - with open(KNOWN_PYLINT_EXCEPTIONS_FILE, "w") as f: - ErrorKeys.print_json(errors, output=f) - - -def validate(newmsg=None): - print "Loading", KNOWN_PYLINT_EXCEPTIONS_FILE - known = ErrorKeys.from_file(KNOWN_PYLINT_EXCEPTIONS_FILE) - if newmsg is None: - print "Running pylint. Be patient..." - newmsg = run_pylint() - errors = LintOutput.from_msg_to_dict(newmsg) - - print "Unique errors reported by pylint: was %d, now %d." \ - % (len(known), len(errors)) - passed = True - for err_key, err_list in errors.items(): - for err in err_list: - if err_key not in known: - print err.lintoutput - print - passed = False - if passed: - print "Congrats! pylint check passed." - redundant = known - set(errors.keys()) - if redundant: - print "Extra credit: some known pylint exceptions disappeared." - for i in sorted(redundant): - print json.dumps(i) - print "Consider regenerating the exception file if you will." - else: - print("Please fix the errors above. If you believe they are false" - " positives, run 'tools/lintstack.py generate' to overwrite.") - sys.exit(1) - - -def usage(): - print """Usage: tools/lintstack.py [generate|validate] - To generate pylint_exceptions file: tools/lintstack.py generate - To validate the current commit: tools/lintstack.py - """ - - -def main(): - option = "validate" - if len(sys.argv) > 1: - option = sys.argv[1] - if option == "generate": - generate_error_keys() - elif option == "validate": - validate() - else: - usage() - - -if __name__ == "__main__": - main() diff --git a/tools/lintstack.sh b/tools/lintstack.sh deleted file mode 100755 index d8591d0..0000000 --- a/tools/lintstack.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2012-2013, AT&T Labs, Yun Mao <yunmao@gmail.com> -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# Use lintstack.py to compare pylint errors. -# We run pylint twice, once on HEAD, once on the code before the latest -# commit for review. -set -e -TOOLS_DIR=$(cd $(dirname "$0") && pwd) -# Get the current branch name. -GITHEAD=`git rev-parse --abbrev-ref HEAD` -if [[ "$GITHEAD" == "HEAD" ]]; then - # In detached head mode, get revision number instead - GITHEAD=`git rev-parse HEAD` - echo "Currently we are at commit $GITHEAD" -else - echo "Currently we are at branch $GITHEAD" -fi - -cp -f $TOOLS_DIR/lintstack.py $TOOLS_DIR/lintstack.head.py - -if git rev-parse HEAD^2 2>/dev/null; then - # The HEAD is a Merge commit. Here, the patch to review is - # HEAD^2, the master branch is at HEAD^1, and the patch was - # written based on HEAD^2~1. - PREV_COMMIT=`git rev-parse HEAD^2~1` - git checkout HEAD~1 - # The git merge is necessary for reviews with a series of patches. - # If not, this is a no-op so won't hurt either. - git merge $PREV_COMMIT -else - # The HEAD is not a merge commit. This won't happen on gerrit. - # Most likely you are running against your own patch locally. - # We assume the patch to examine is HEAD, and we compare it against - # HEAD~1 - git checkout HEAD~1 -fi - -# First generate tools/pylint_exceptions from HEAD~1 -$TOOLS_DIR/lintstack.head.py generate -# Then use that as a reference to compare against HEAD -git checkout $GITHEAD -$TOOLS_DIR/lintstack.head.py -echo "Check passed. FYI: the pylint exceptions are:" -cat $TOOLS_DIR/pylint_exceptions - @@ -1,26 +1,20 @@ [tox] -envlist = py27,py37,pep8 +envlist = py37,pep8 +ignore_basepython_conflict = true [testenv] +basepython = python3 setenv = VIRTUAL_ENV={envdir} -install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} -deps = -r{toxinidir}/requirements.txt +deps =-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = stestr run --slowest {posargs} [testenv:pep8] -basepython = python3 commands = flake8 flake8 --filename=cfn-* bin -[testenv:pylint] -setenv = VIRTUAL_ENV={envdir} -deps = -r{toxinidir}/requirements.txt - pylint==0.26.0 -commands = bash tools/lintstack.sh - [testenv:cover] -basepython = python3 setenv = {[testenv]setenv} PYTHON=coverage run --source heat_cfntools --parallel-mode @@ -31,7 +25,6 @@ commands = coverage xml -o cover/coverage.xml [testenv:venv] -basepython = python3 commands = {posargs} [flake8] @@ -39,12 +32,10 @@ show-source = true exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools [testenv:docs] -basepython = python3 deps = -r{toxinidir}/doc/requirements.txt commands = sphinx-build -W -b html doc/source doc/build/html [testenv:lower-constraints] -basepython = python3 deps = -c{toxinidir}/lower-constraints.txt -r{toxinidir}/requirements.txt |