From 0407bb62a3fb5d3b0879f49b2bbb8dbe02bc3830 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Sun, 22 Feb 2015 01:47:32 +0000 Subject: [PATCH] Sync with openstack-dev/cookiecutter Update boilerplate content, modernize for more recent PBR advancements, and get tests and style checks working. Change-Id: I86b6a171d2d81dd870f092542d2f4569a6772fac --- .coveragerc | 6 +++++ .gitignore | 49 +++++++++++++++++++++++++----------- .mailmap | 3 +++ .testr.conf | 5 +++- MANIFEST.in | 8 ------ bindep/tests/test_depends.py | 1 - bindep/tests/test_main.py | 1 - requirements.txt | 3 +-- setup.cfg | 30 ++++++++++++---------- setup.py | 13 +++++++--- test-requirements.txt | 3 ++- tox.ini | 39 +++++++++++++--------------- 12 files changed, 94 insertions(+), 67 deletions(-) create mode 100644 .coveragerc create mode 100644 .mailmap diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..32137da --- /dev/null +++ b/.coveragerc @@ -0,0 +1,6 @@ +[run] +branch = True +source = bindep + +[report] +ignore-errors = True diff --git a/.gitignore b/.gitignore index c3ae5eb..8a3c704 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,9 @@ -# Compiled files -*.py[co] -*.a -*.o +*.py[cod] + +# C extensions *.so -# Sphinx -_build - -# Packages/installer info +# Packages *.egg *.egg-info dist @@ -19,16 +15,39 @@ var sdist develop-eggs .installed.cfg +lib +lib64 -# Other -.testrepository -.tox -.*.swp +# Installer logs +pip-log.txt + +# Unit test / coverage reports .coverage -cover +.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 -# Editor files +# Editors *~ -*.swp +.*.swp +.*sw? diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..516ae6f --- /dev/null +++ b/.mailmap @@ -0,0 +1,3 @@ +# Format is: +# +# diff --git a/.testr.conf b/.testr.conf index a2ff14b..6d83b3c 100644 --- a/.testr.conf +++ b/.testr.conf @@ -1,4 +1,7 @@ [DEFAULT] -test_command=${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION +test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ + OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ + OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ + ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list diff --git a/MANIFEST.in b/MANIFEST.in index 5cd923e..c978a52 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,13 +1,5 @@ include AUTHORS include ChangeLog -include CONTRIBUTING.rst -include LICENSE -include README.rst -include other-requirements.txt -include requirements.txt -include test-requirements.txt -include tox.ini -recursive-include doc * exclude .gitignore exclude .gitreview diff --git a/bindep/tests/test_depends.py b/bindep/tests/test_depends.py index 57de9ba..2e3d51d 100644 --- a/bindep/tests/test_depends.py +++ b/bindep/tests/test_depends.py @@ -231,4 +231,3 @@ class TestEval(TestCase): self.assertEqual(False, _eval("3.5-ubuntu", ">=", "4")) self.assertEqual(True, _eval("4", ">=", "3.5-ubuntu")) self.assertEqual(True, _eval("4", ">=", "4")) - diff --git a/bindep/tests/test_main.py b/bindep/tests/test_main.py index f5f3fba..392bf45 100644 --- a/bindep/tests/test_main.py +++ b/bindep/tests/test_main.py @@ -131,4 +131,3 @@ class TestMain(TestCase): """), logger.output) self.addCleanup(mocker.VerifyAll) self.addCleanup(mocker.UnsetStubs) - diff --git a/requirements.txt b/requirements.txt index c9991ba..dbc5aa1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ -d2to1>=0.2.10,<0.3 -pbr +pbr>=0.6,!=0.7,<1.0 Parsley diff --git a/setup.cfg b/setup.cfg index 4fd58c5..3de06a0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,32 +1,36 @@ [metadata] name = bindep -author = OpenStack -author-email = openstack-dev@lists.openstack.org summary = Binary dependency utility description-file = README.rst +author = OpenStack +author-email = openstack-dev@lists.openstack.org home-page = http://pypi.python.org/pypi/bindep classifier = Development Status :: 4 - Beta - Environment :: Console - Environment :: OpenStack - Intended Audience :: Developers - Intended Audience :: Information Technology - License :: OSI Approved :: Apache Software License - Operating System :: OS Independent - Programming Language :: Python + Environment :: Console + Environment :: OpenStack + Intended Audience :: Developers + Intended Audience :: Information Technology + License :: OSI Approved :: Apache Software License + Operating System :: OS Independent + Programming Language :: Python [files] packages = bindep -[global] -setup-hooks = - pbr.hooks.setup_hook - [pbr] warnerrors = True [entry_points] console_scripts = bindep = bindep.main: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 index 410870a..ee06f22 100755 --- a/setup.py +++ b/setup.py @@ -16,7 +16,14 @@ 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=['d2to1>=0.2.10,<0.3', 'pbr'], - d2to1=True, -) + setup_requires=['pbr'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt index f05ac7c..5121fb6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,8 @@ +hacking>=0.10.0,<0.11 + coverage>=3.6 discover fixtures>=0.3.12 -flake8 mox==0.5.3 python-subunit sphinx>=1.1.2 diff --git a/tox.ini b/tox.ini index 6081aa3..602ed3c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,37 +1,32 @@ [tox] -envlist = py26,py27,pep8 +envlist = py34,py26,py27,pypy,pep8 +skipdist = True [testenv] +usedevelop = True +install_command = pip install -U {opts} {packages} setenv = VIRTUAL_ENV={envdir} - LANG=en_US.UTF-8 - LANGUAGE=en_US:en - LC_ALL=C deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = - python setup.py testr --slowest --testr-args='{posargs}' - -[tox:jenkins] -sitepackages = True -downloadcache = ~/cache/pip + python setup.py test --slowest --testr-args='{posargs}' [testenv:pep8] -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt - hacking commands = flake8 -[testenv:cover] -setenv = VIRTUAL_ENV={envdir} -commands = - python setup.py testr --coverage - [testenv:venv] commands = {posargs} -[flake8] -exclude = .venv,.tox,dist,doc,*.egg,build -show-source = true -# E125 disabled because if (foo\n bar...): is cromulent. -ignore = H302,W391,E125 +[testenv:cover] +commands = python setup.py test --coverage --testr-args='{posargs}' +[testenv:docs] +commands = python setup.py build_sphinx + +[flake8] +# E123, E125 skipped as they are invalid PEP-8. + +show-source = True +ignore = E123,E125,E129,H +builtins = _ +exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build