From 76d6a95bb5635eab7e8244d8ceaf1b5d149716a9 Mon Sep 17 00:00:00 2001 From: "Gael Chamoulaud (Strider)" Date: Fri, 28 Feb 2020 13:24:30 +0100 Subject: [PATCH] Adding the foundation files * tox linters tests * Adds requirements files * Adds bindep.txt * Adds gitignore file * Adds pre-commit configuration file Signed-off-by: Gael Chamoulaud (Strider) --- .gitignore | 62 +++++++++++++++++++++ .pre-commit-config.yaml | 16 ++++++ MANIFEST.in | 6 ++ README.md => README.rst | 0 bindep.txt | 37 +++++++++++++ lower-constraints.txt | 118 ++++++++++++++++++++++++++++++++++++++++ requirements.txt | 6 ++ setup.cfg | 37 +++++++++++++ setup.py | 29 ++++++++++ test-requirements.txt | 6 ++ tox.ini | 68 +++++++++++++++++++++++ 11 files changed, 385 insertions(+) create mode 100644 .gitignore create mode 100644 .pre-commit-config.yaml create mode 100644 MANIFEST.in rename README.md => README.rst (100%) create mode 100644 bindep.txt create mode 100644 lower-constraints.txt create mode 100644 test-requirements.txt create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..c71f9eaf --- /dev/null +++ b/.gitignore @@ -0,0 +1,62 @@ +*.py[cod] + +# C extensions +*.so + +# Packages +*.egg* +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +lib +lib64 + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +cover/ +.coverage* +!.coveragerc +.tox +nosetests.xml +.testrepository +.venv + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Complexity +output/*.html +output/*/index.html + +# Sphinx +doc/build + +# pbr generates these +AUTHORS +ChangeLog + +# Editors +*~ +.*.swp +.*sw? + +# Files created by releasenotes build +releasenotes/build + +# Ansible specific +hosts +*.retry diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..6c6217f1 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,16 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.5.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace + - id: mixed-line-ending + - id: check-byte-order-marker + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: debug-statements + - id: flake8 + entry: flake8 --ignore=E24,E121,E122,E123,E124,E126,E226,E265,E305,E402,F401,F405,E501,E704,F403,F841,W503,W605 + - id: check-yaml + files: .*\.(yaml|yml)$ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..c978a52d --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include AUTHORS +include ChangeLog +exclude .gitignore +exclude .gitreview + +global-exclude *.pyc diff --git a/README.md b/README.rst similarity index 100% rename from README.md rename to README.rst diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 00000000..8e60cc8f --- /dev/null +++ b/bindep.txt @@ -0,0 +1,37 @@ +# This file facilitates OpenStack-CI package installation +# before the execution of any tests. +# +# See the following for details: +# - https://docs.openstack.org/infra/bindep/ +# - https://opendev.org/opendev/bindep/ +# +# Even if the role does not make use of this facility, it +# is better to have this file empty, otherwise OpenStack-CI +# will fall back to installing its default packages which +# will potentially be detrimental to the tests executed. + +# The gcc compiler +gcc + +# Base requirements for RPM distros +gcc-c++ [platform:rpm] +git [platform:rpm] +libffi-devel [platform:rpm] +openssl-devel [platform:rpm] +python-devel [platform:rpm !platform:rhel-8 !platform:centos-8] +python3-devel [platform:rpm !platform:rhel-7 !platform:centos-7] +PyYAML [platform:rpm !platform:rhel-8 !platform:centos-8] +python3-pyyaml [platform:rpm !platform:rhel-7 !platform:centos-7] +python3-dnf [platform:rpm !platform:rhel-7 !platform:centos-7] + +# For SELinux +libselinux-python [platform:rpm !platform:rhel-8 !platform:centos-8] +libsemanage-python [platform:redhat !platform:rhel-8 !platform:centos-8] +libselinux-python3 [platform:rpm !platform:rhel-7 !platform:centos-7] +libsemanage-python3 [platform:redhat !platform:rhel-7 !platform:centos-7] + +# Required for compressing collected log files in CI +gzip + +# Required to build language docs +gettext diff --git a/lower-constraints.txt b/lower-constraints.txt new file mode 100644 index 00000000..7dcfd836 --- /dev/null +++ b/lower-constraints.txt @@ -0,0 +1,118 @@ +alabaster==0.7.10 +ansible-lint==3.4.21 +ansible==2.4.3.0 +anyjson==0.3.3 +appdirs==1.4.3 +asn1crypto==0.24.0 +Babel==2.5.3 +bcrypt==3.1.4 +certifi==2018.1.18 +cffi==1.11.5 +chardet==3.0.4 +cliff==2.11.0 +cmd2==0.8.1 +coverage==4.0 +cryptography==2.1.4 +debtcollector==1.19.0 +decorator==4.3.0 +deprecation==2.0 +docker-pycreds==0.2.2 +docker==3.1.1 +docutils==0.14 +dogpile.cache==0.6.5 +dulwich==0.19.0 +enum-compat==0.0.2 +eventlet==0.20.0 +extras==1.0.0 +fasteners==0.14.1 +fixtures==3.0.0 +flake8==2.5.5 +gitdb2==2.0.3 +GitPython==2.1.8 +greenlet==0.4.13 +hacking==0.11.0 +idna==2.6 +imagesize==1.0.0 +iso8601==0.1.12 +Jinja2==2.10 +jmespath==0.9.3 +jsonpatch==1.21 +jsonpointer==2.0 +jsonschema==2.6.0 +keystoneauth1==3.12.0 +linecache2==1.0.0 +MarkupSafe==1.0 +mccabe==0.2.1 +mistral-lib==1.2.0 +mock==2.0.0 +monotonic==1.4 +mox3==0.25.0 +msgpack==0.5.6 +munch==2.2.0 +netaddr==0.7.18 +netifaces==0.10.6 +openstackdocstheme==1.20.0 +openstacksdk==0.24.0 +os-client-config==1.29.0 +os-net-config==7.1.0 +os-service-types==1.2.0 +osc-lib==1.14.0 +oslo.concurrency==3.26.0 +oslo.config==5.2.0 +oslo.context==2.22.0 +oslo.i18n==3.20.0 +oslo.log==3.37.0 +oslo.serialization==2.25.0 +oslo.utils==3.40.2 +oslotest==3.2.0 +packaging==17.1 +paramiko==2.4.1 +passlib==1.7.1 +pbr==3.1.1 +pep8==1.5.7 +prettytable==0.7.2 +pyasn1==0.4.2 +pycparser==2.18 +pyflakes==0.8.1 +Pygments==2.2.0 +pyinotify==0.9.6 +PyNaCl==1.2.1 +pyOpenSSL==17.5.0 +pyparsing==2.2.0 +pyperclip==1.6.0 +python-dateutil==2.7.0 +python-glanceclient==2.9.1 +python-heatclient==1.10.0 +python-ironic-inspector-client==3.1.1 +python-ironicclient==2.7.0 +python-keystoneclient==3.20.0 +python-mimeparse==1.6.0 +python-mistralclient==3.1.0 +python-novaclient==15.0.0 +python-subunit==1.0.0 +python-swiftclient==3.5.0 +python-zaqarclient==1.9.0 +pytz==2018.3 +PyYAML==3.12 +reno==2.5.0 +requests==2.18.4 +requestsexceptions==1.4.0 +rfc3986==1.1.0 +simplejson==3.13.2 +six==1.11.0 +smmap2==2.0.3 +snowballstemmer==1.2.1 +Sphinx==1.8.0 +sphinxcontrib-websupport==1.0.1 +stevedore==1.28.0 +tenacity==5.0.1 +testrepository==0.0.18 +testscenarios==0.4 +testtools==2.2.0 +traceback2==1.4.0 +tripleo-common==7.1.0 +unittest2==1.1.0 +urllib3==1.22 +warlock==1.3.0 +websocket-client==0.47.0 +wrapt==1.10.11 diff --git a/requirements.txt b/requirements.txt index e69de29b..832dd35c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1,6 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. + +pbr>=3.1.1 # Apache-2.0 +six>=1.11.0 # MIT diff --git a/setup.cfg b/setup.cfg index e69de29b..5510e11a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -0,0 +1,37 @@ +[metadata] +name = validations-libs +summary = A common library for the validations framework +description-file = + README.rst +author = OpenStack +author-email = openstack-discuss@lists.openstack.org +home-page = https://docs.openstack.org/tripleo-validations/latest/ +classifier = + Environment :: OpenStack + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + +[files] +packages = validations_libs + +[compile_catalog] +directory = validations-libs/locale +domain = validations-lib + +[update_catalog] +domain = validations-libs +output_dir = validations-libs/locale +input_file = validations-libs/locale/validations-libs.pot + +[extract_messages] +keywords = _ gettext ngettext l_ lazy_gettext +mapping_file = babel.cfg +output_file = validations-libs/locale/validations-libs.pot + +[entry_points] diff --git a/setup.py b/setup.py index e69de29b..566d8443 100644 --- a/setup.py +++ b/setup.py @@ -0,0 +1,29 @@ +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# 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. + +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +# In python < 2.7.4, a lazy loading of package `pbr` will break +# setuptools if some other modules registered functions in `atexit`. +# solution from: http://bugs.python.org/issue15881#msg170215 +try: + import multiprocessing # noqa +except ImportError: + pass + +setuptools.setup( + setup_requires=['pbr>=2.0.0'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..55ddbd2b --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,6 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. + +hacking<0.12,>=0.11.0 # Apache-2.0 +pre-commit # MIT diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..b09fcecd --- /dev/null +++ b/tox.ini @@ -0,0 +1,68 @@ +[tox] +minversion = 2.0 +envlist = linters +skipdist = True + +[testenv] +usedevelop = True +passenv = * +setenv = + # pip: Avoid 2020-01-01 warnings: https://github.com/pypa/pip/issues/6207 + # paramiko CryptographyDeprecationWarning: https://github.com/ansible/ansible/issues/52598 + PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command,ignore::UserWarning + PIP_DISABLE_PIP_VERSION_CHECK=1 +commands = python setup.py test --slowest --testr-args='{posargs}' +sitepackages = True +deps = + -c {env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -r {toxinidir}/requirements.txt + -r {toxinidir}/test-requirements.txt +whitelist_externals = bash + +[testenv:bindep] +# Do not install any requirements. We want this to be fast and work even if +# system dependencies are missing, since it's used to tell you what system +# dependencies are missing! This also means that bindep must be installed +# separately, outside of the requirements files. +deps = bindep +commands = bindep test + +[testenv:debug] +commands = oslo_debug_helper {posargs} + +[testenv:pep8] +envdir = {toxworkdir}/linters +commands = + python -m pre_commit run flake8 -a + +[testenv:whitespace] +envdir = {toxworkdir}/linters +deps = {[testenv:linters]deps} +commands = + python -m pre_commit run trailing-whitespace -a + +[testenv:shebangs] +envdir = {toxworkdir}/linters +deps = {[testenv:linters]deps} +commands = + python -m pre_commit run check-executables-have-shebangs -a + +[testenv:linters] +deps = + -r {toxinidir}/requirements.txt + -r {toxinidir}/test-requirements.txt +commands = + {[testenv:whitespace]commands} + {[testenv:shebangs]commands} + +[testenv:cover] +deps = + -r {toxinidir}/requirements.txt + -r {toxinidir}/test-requirements.txt +commands = python setup.py test --coverage --testr-args='{posargs}' + +[testenv:lower-constraints] +deps = + -c{toxinidir}/lower-constraints.txt + -r{toxinidir}/test-requirements.txt + -r{toxinidir}/requirements.txt