From b2b77d6cd13db784e2dfaf5e06dd458970816f14 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Wed, 6 Aug 2014 14:07:01 +0200 Subject: [PATCH] Add support for Tox Change-Id: I6974c78e15e34cbe1ce28b2f43525dd267b814e4 --- .gitignore | 24 +++++++++++++++++ gerrit_dash_creator/cmd/creator.py | 3 ++- requirements.txt | 2 ++ setup.cfg | 42 ++++++++++++++++++++++++++++++ setup.py | 22 ++++++++++++++++ test-requirements.txt | 11 ++++++++ tox.ini | 34 ++++++++++++++++++++++++ 7 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 requirements.txt create mode 100644 setup.cfg create mode 100755 setup.py create mode 100644 test-requirements.txt create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7ae095e --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +.DS_Store +.venv + +# Packages +*.py[cod] +*.egg +*.egg-info +dist +build +eggs +sdist + +# Unit test / coverage reports +.coverage +.tox + +# pbr generates these +AUTHORS +ChangeLog + +# Editors +*~ +.*.swp +.bak diff --git a/gerrit_dash_creator/cmd/creator.py b/gerrit_dash_creator/cmd/creator.py index 4da860d..45d0ea2 100755 --- a/gerrit_dash_creator/cmd/creator.py +++ b/gerrit_dash_creator/cmd/creator.py @@ -67,7 +67,8 @@ def gen_url(title, foreach, sections): def get_options(): parser = argparse.ArgumentParser( - description='Create a gerrit dashboard URL from a dashboard definition') + description='Create a gerrit dashboard URL from a dashboard ' + 'definition') parser.add_argument('dash', metavar='dashboard_file', help="Dashboard file to create url from") diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..770417f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +argparse +pbr>=0.6,!=0.7,<1.0 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..cec16e9 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,42 @@ +[metadata] +name = gerrit-dash-creator +summary = Gerrit Dashboard Creator +description-file = + README.rst +author = OpenStack +author-email = openstack-dev@lists.openstack.org +home-page = https://github.com/stackforge/gerrit-dash-creator/ +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 :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 2.6 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.3 + +[global] +setup-hooks = + pbr.hooks.setup_hook + +[files] +packages = + gerrit_dash_creator +data_files = + share/gerrit-dash-creator = dashboards/* + +[entry_points] +console_scripts = + gerrit-dash-creator = gerrit_dash_creator.cmd.creator:main + +[build_sphinx] +source-dir = doc/source +build-dir = doc/build +all_files = 1 + +[upload_sphinx] +upload-dir = doc/build/html diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..70c2b3f --- /dev/null +++ b/setup.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# 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 + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..c9cc3da --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,11 @@ +hacking>=0.9.2,<0.10 + +coverage>=3.6 +discover +fixtures>=0.3.14 +python-subunit +sphinx>=1.1.2 +oslosphinx +testrepository>=0.0.17 +testscenarios>=0.4,<0.5 +testtools>=0.9.32 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..0fda16f --- /dev/null +++ b/tox.ini @@ -0,0 +1,34 @@ +[tox] +minversion = 1.6 +envlist = py33,py26,py27,pypy,pep8 +skipsdist = True + +[testenv] +usedevelop = True +install_command = pip install -U {opts} {packages} +setenv = + VIRTUAL_ENV={envdir} +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = python setup.py testr --slowest --testr-args='{posargs}' + +[testenv:pep8] +commands = flake8 + +[testenv:venv] +commands = {posargs} + +[testenv:cover] +commands = python setup.py testr --coverage --testr-args='{posargs}' + +[testenv:docs] +commands = python setup.py build_sphinx + +[flake8] +# H803 skipped on purpose per list discussion. +# E123, E125 skipped as they are invalid PEP-8. + +show-source = True +ignore = E123,E125,H803 +builtins = _ +exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build