Add basic package structure

* Use PBR with minimal setup files to allow packaging
* Add tox configuration and enable PEP8/ansible-lint environments
This commit is contained in:
Will Miller 2018-08-28 11:02:47 +00:00
parent 9840887e3c
commit 740432dbd0
5 changed files with 107 additions and 0 deletions

6
requirements.txt Normal file
View File

@ -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>=2.0 # Apache-2.0
ansible>=2.6.0 # GPLv3

20
setup.cfg Normal file
View File

@ -0,0 +1,20 @@
[metadata]
name = tenks
summary = Deployment of virtual bare metal clusters with Tenks
description-file =
README.md
author = Will Miller
author-email = willm@stackhpc.com
home-page = https://stackhpc.com
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
Intended Audience :: System Administrators
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
[files]
packages =
tenks

29
setup.py Normal file
View File

@ -0,0 +1,29 @@
# Copyright (c) 2018 StackHPC Ltd.
#
# 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'],
pbr=True)

6
test-requirements.txt Normal file
View File

@ -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.
ansible-lint>=3.0.0 # MIT
flake8>=3.5.0 # MIT

46
tox.ini Normal file
View File

@ -0,0 +1,46 @@
[tox]
minversion = 2.0
envlist = py35,py27,pep8,alint
skipsdist = True
[testenv]
usedevelop = True
install_command = pip install {opts} {packages}
passenv =
HOME
whitelist_externals =
bash
rm
setenv =
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/rocky}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:pep8]
basepython = python3
commands =
flake8 {posargs}
[testenv:alint]
basepython = python3
# ansible-lint doesn't support custom modules, so add ours to the Ansible path.
setenv = ANSIBLE_LIBRARY = {toxinidir}/ansible/action_plugins/
# Exclude roles downloaded from Galaxy (in the form 'author.role') from
# linting.
commands = bash -c "ansible-lint \
$(find {toxinidir}/ansible -path '*.yml' \
-not -path '{toxinidir}/ansible/roles/*.*/*' -print)"
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
ignore = E123,E125
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build