From 6760f922e0dcac3a7dbb78bb552905b945544291 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sat, 22 Mar 2014 19:26:18 -0700 Subject: [PATCH] Remove usage of pbr Anvil has conflicts with pbr when it's used in setup.py and its usage in anvil doesn't really seem useful or applicable given the amount of pain it causes during packaging and later pip usage (dependencies downloaded and introspected will themselves fail due to the wrong version of pbr that anvil pulled in). So instead of using it, just switch back to using a simpler setup.py file with usage of nosetests for testing (since we don't need parallel tests for anvils tests) to avoid the problems that pbr has caused. Change-Id: I6d3c09a927434abf07fc025638a0860e44b029fa --- .testr.conf | 8 ----- MANIFEST.in | 9 ++++-- anvil/version.py | 2 +- pylintrc | 5 ++-- requirements.txt | 4 --- setup.cfg | 47 ----------------------------- setup.py | 70 +++++++++++++++++++++++++++++++++++-------- test-requirements.txt | 15 ++-------- tox.ini | 18 ++++------- 9 files changed, 74 insertions(+), 104 deletions(-) delete mode 100644 .testr.conf delete mode 100644 setup.cfg mode change 100644 => 100755 setup.py diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 257526dd..00000000 --- a/.testr.conf +++ /dev/null @@ -1,8 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \ - ${PYTHON:-python} -m subunit.run discover -t ./ ./anvil/tests $LISTOPT $IDOPTION - -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/MANIFEST.in b/MANIFEST.in index c978a52d..e2a10649 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,9 @@ -include AUTHORS -include ChangeLog +include README.rst +include HACKING.md +include requirements.txt +include test-requirements.txt +include LICENSE + exclude .gitignore exclude .gitreview - global-exclude *.pyc diff --git a/anvil/version.py b/anvil/version.py index 17c70d55..d1391f07 100644 --- a/anvil/version.py +++ b/anvil/version.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -ANVIL_VERSION = ['2013', '1', None] +ANVIL_VERSION = ['2014', '1', None] YEAR, COUNT, REVISION = ANVIL_VERSION FINAL = False # May never be final ;) diff --git a/pylintrc b/pylintrc index 476dd7bc..a0bd757a 100644 --- a/pylintrc +++ b/pylintrc @@ -12,8 +12,7 @@ profile=no # Add to the black list. It should be a base name, not a # path. You may set this option multiple times. - -# ignore= +ignore=anvil/tests/ # Pickle collected data for later comparisons. persistent=yes @@ -270,4 +269,4 @@ max-attributes=12 min-public-methods=0 # Maximum number of public methods for a class (see R0904). -max-public-methods=80 +max-public-methods=100 diff --git a/requirements.txt b/requirements.txt index 302755be..d6aafd1f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,3 @@ -# Anvil should not depend on anything that will cause issues when running -# egg_info on the downloaded dependencies, pbr seems to be the one case that -# currently causes an issue (since it is not directly used for anvil runtime -# it is placed in test-requirements for the time being). cheetah>=2.4.4 iniparse iso8601>=0.1.8 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index c268a7c7..00000000 --- a/setup.cfg +++ /dev/null @@ -1,47 +0,0 @@ -[metadata] -name = anvil -version = 2013.2 -summary = A tool to forge raw OpenStack into a productive tool -description-file = - README.rst -author = OpenStack Foundation -author-email = openstack-dev@lists.openstack.org -home-page = http://anvil.readthedocs.org/ -classifier = - Development Status :: 4 - Beta - Environment :: Console - Environment :: OpenStack - Intended Audience :: Information Technology - Intended Audience :: Developers - 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.6 - Programming Language :: Python :: 2.7 - -[global] -setup-hooks = - pbr.hooks.setup_hook - -[files] -packages = - anvil - -scripts = - tools/multipip - tools/py2rpm - tools/specprint - tools/yyoom - -[nosetests] -verbosity=2 - -[build_sphinx] -source-dir = docs/source -build-dir = docs/build -all_files = 1 - -[upload_sphinx] -upload-dir = docs/build/html diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index c0a24eab..b10d9eb8 --- a/setup.py +++ b/setup.py @@ -1,21 +1,65 @@ #!/usr/bin/env python -# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. + +# Copyright (C) 2014 Yahoo! Inc. 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 +# 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 +# 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. +# 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. import setuptools +from anvil import version + + +def read_requires(filename): + requires = [] + with open(filename, "rb") as fh: + for line in fh: + line = line.strip() + if not line or line.startswith("#"): + continue + requires.append(line) + return requires + + setuptools.setup( - setup_requires=['pbr'], - pbr=True) + name='anvil', + description='A tool to forge raw OpenStack into a productive tool', + author='OpenStack Foundation', + author_email='anvil-dev@lists.launchpad.net', + url='http://anvil.readthedocs.org/', + long_description=open("README.rst", 'rb').read(), + packages=setuptools.find_packages(), + license='Apache Software License', + version=version.version_string(), + scripts=[ + "tools/yyoom", + "tools/py2rpm", + "tools/multipip", + "tools/specprint", + ], + install_requires=read_requires("requirements.txt"), + tests_require=read_requires("test-requirements.txt"), + classifiers=[ + 'Development Status :: 4 - Beta', + 'Environment :: Console', + 'Environment :: OpenStack', + 'Intended Audience :: Information Technology', + 'Intended Audience :: Developers', + '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.6', + 'Programming Language :: Python :: 2.7', + ], +) diff --git a/test-requirements.txt b/test-requirements.txt index 23758d29..835c6e42 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,16 +1,5 @@ -# Install bounded pep8/pyflakes first, then let flake8 install -pep8==1.4.5 -pyflakes>=0.7.2,<0.7.4 -flake8==2.0 pylint==0.25.2 hacking>=0.8.0,<0.9 mock>=1.0 -# This is only needed for running anvils setup.py which is not done -# during running of anvil, but is done during testing or package -# creation... -# -# Using it in the created virtualenv causes conflict with -# other openstack packages (running there setup.py egg_info will break) -# so placing it here means that we will avoid such conflicts in the first -# place. -pbr>=0.5.21,<1.0 +nose +testtools>=0.9.34 diff --git a/tox.ini b/tox.ini index ebb76823..88948d71 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,6 @@ [tox] -minversion = 1.6 skipdist = True -envlist = py26,py27,pep8 +envlist = py26,py27,pep8,pylint [testenv] usedevelop = True @@ -9,11 +8,7 @@ install_command = pip install {opts} {packages} setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt - discover - python-subunit>=0.0.18 - testtools>=0.9.34 - testrepository>=0.0.17 -commands = python setup.py testr --slowest --testr-args='{posargs}' +commands = nosetests {posargs} [tox:jenkins] downloadcache = ~/cache/pip @@ -28,11 +23,6 @@ deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = pylint --rcfile=pylintrc anvil -[testenv:cover] -deps = {[testenv]deps} - coverage>=3.6 -commands = python setup.py testr --coverage --testr-args='{posargs}' - [testenv:venv] commands = {posargs} @@ -40,3 +30,7 @@ commands = {posargs} ignore = H102,H302,E501 builtins = _ exclude = .venv,.tox,dist,doc,*egg,.git,build + +[nosetests] +verbosity = 2 +detailed-errors = 1