From ae5d0c61a3e9ca81245b1040c1735619f4dc42d6 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sat, 17 Aug 2013 23:50:41 -0400 Subject: [PATCH] Align build files and requirements This is not an actual python project, so there is an amount of cruft in the repo that is not needed. However, it does generate tarballs in OpenStack Infra, so it needs the tox venv environment and the pbr setup.py stuff. It also is totally possible to check python files in the repo for flake8 violations, so set that up. Change-Id: Ifb94f65912716efe1c4596d552beee92d2dc3d6a --- elements/snmpd/files/check_proc_open_files.py | 4 +- requirements.txt | 1 + setup.cfg | 11 ++--- setup.py | 8 ++-- test-requirements.txt | 1 + tools/test-requires | 2 - tox.ini | 47 +++++-------------- 7 files changed, 25 insertions(+), 49 deletions(-) create mode 100644 requirements.txt create mode 100644 test-requirements.txt delete mode 100644 tools/test-requires diff --git a/elements/snmpd/files/check_proc_open_files.py b/elements/snmpd/files/check_proc_open_files.py index e57c06818..56f4207f3 100644 --- a/elements/snmpd/files/check_proc_open_files.py +++ b/elements/snmpd/files/check_proc_open_files.py @@ -14,10 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. +import itertools import shlex import subprocess import sys -import itertools warn_limit = 90 crit_limit = 95 @@ -89,5 +89,5 @@ if not output_msg: output_msg = "OK - All processes open files with in limits." exit_code = status['OK'] -print output_msg +print(output_msg) sys.exit(exit_code) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..4e46b891f --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pbr>=0.5.21,<1.0 diff --git a/setup.cfg b/setup.cfg index f95dea740..4de9e634b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,11 +4,12 @@ version = 0.0.1 summary = Disk image builder elements for deploying OpenStack. description-file = README.md -author = HP Cloud Services +author = OpenStack author_email = openstack-dev@lists.openstack.org -license: Apache License (2.0) -home-page = https://github.com/openstack/tripleo-image-elements +license = Apache License (2.0) +home-page = https://git.openstack.org/cgit/openstack/tripleo-image-elements classifier = + Environment :: OpenStack Development Status :: 3 - Alpha License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux @@ -18,7 +19,3 @@ classifier = [files] data_files = share/tripleo-image-elements = elements/* - -[global] -setup-hooks = - pbr.hooks.setup_hook diff --git a/setup.py b/setup.py index 3e74fe081..70c2b3f32 100755 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ -#!/usr/bin/python +#!/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. @@ -13,8 +14,9 @@ # 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=['d2to1>=0.2.10,<0.3', 'pbr>=0.5.10,<0.6'], - d2to1=True) + setup_requires=['pbr'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..f0dd00b97 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +hacking>=0.5.6,<0.8 diff --git a/tools/test-requires b/tools/test-requires deleted file mode 100644 index 0cf0fc186..000000000 --- a/tools/test-requires +++ /dev/null @@ -1,2 +0,0 @@ -testtools -fixtures diff --git a/tox.ini b/tox.ini index 30e0d88db..83b8af18a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,43 +1,20 @@ [tox] -envlist = py26,py27,pep8 +minversion = 1.6 +skipsdist = True +envlist = pep8 [testenv] -setenv = LANG=en_US.UTF-8 - LANGUAGE=en_US:en - LC_ALL=C -deps= - testtools - testrepository - coverage - babel -commands= - bash -c 'if [ ! -d ./.testrepository ] ; then testr init ; fi' - bash -c 'testr run --parallel {posargs} ; RET=$? echo "Slowest Tests" ; testr slowest && exit $RET' - -[testenv:py26] -deps= - testtools - testrepository - coverage - babel - discover - argparse - -[pep8] -ignore = E125 - -[testenv:pep8] -deps = pep8 -commands = - pep8 --repeat --show-source --exclude=.venv,.tox,doc . +usedevelop = True +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt [testenv:venv] commands = {posargs} -[testenv:cover] -setenv = PYTHON=coverage run --source tripleo_image_elements -commands = bash -c 'if [ ! -d ./.testrepository ] ; then testr init ; fi' - bash -c 'testr run --parallel ; RET=$? ; coverage combine ; coverage html -d ./cover $OMIT && exit $RET' +[testenv:pep8] +commands = flake8 -[tox:jenkins] -downloadcache = ~/cache/pip +[flake8] +ignore = E125,H803 +exclude = .venv,.tox,dist,doc,*.egg +show-source = true