From 3e19273cc139536c47a8b8321fb4d04d34657900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Nov=C3=BD?= Date: Sun, 15 Nov 2015 21:11:36 +0100 Subject: [PATCH] Change setup.py to OS one Change-Id: Ia23c12de5f6448793aa3584e3041711d68b92953 --- .coveragerc | 6 ++ .gitignore | 2 + AUTHORS | 3 +- CONTRIBUTING.rst | 17 ++++ setup.cfg | 40 +++++++++ setup.py | 84 +++---------------- test-requirements.txt | 2 +- {test_swauth => test}/__init__.py | 0 {test_swauth => test}/unit/__init__.py | 0 {test_swauth => test}/unit/test_authtypes.py | 0 {test_swauth => test}/unit/test_middleware.py | 0 tox.ini | 19 +++-- 12 files changed, 92 insertions(+), 81 deletions(-) create mode 100644 .coveragerc create mode 100644 CONTRIBUTING.rst rename {test_swauth => test}/__init__.py (100%) rename {test_swauth => test}/unit/__init__.py (100%) rename {test_swauth => test}/unit/test_authtypes.py (100%) rename {test_swauth => test}/unit/test_middleware.py (100%) diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..52c7ed7 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,6 @@ +[run] +branch = True +omit = /usr*,setup.py,*egg*,.venv/*,.tox/*,test/* + +[report] +ignore_errors = True diff --git a/.gitignore b/.gitignore index 0558c26..f6effc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.egg-info *.py[co] .DS_Store +.coverage +cover diff --git a/AUTHORS b/AUTHORS index 62df76e..6a6a47f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -32,11 +32,12 @@ Eohyung Lee Fujita Tomonori Kapil Thangavelu Monty Taylor -Ondrej Novy +Ondřej Nový Pablo Llopis Paul Jimenez Prashanth Pai Pete Zaitcev +Peter Lisák Rodney Beede Russ Nelson Scott Simpson diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 0000000..6d1befd --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,17 @@ +If you would like to contribute to the development of OpenStack, you must +follow the steps in this page: + + http://docs.openstack.org/infra/manual/developers.html + +If you already have a good understanding of how the system works and your +OpenStack accounts are set up, you can skip to the development workflow +section of this documentation to learn how changes to OpenStack should be +submitted for review via the Gerrit tool: + + http://docs.openstack.org/infra/manual/developers.html#development-workflow + +Pull requests submitted through GitHub will be ignored. + +Bugs should be filed on Launchpad, not GitHub: + + https://bugs.launchpad.net/swauth diff --git a/setup.cfg b/setup.cfg index a0122b1..dddfe2a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,43 @@ +[metadata] +name = swauth +summary = An alternative authentication system for Swift +description-file = + README.md +author = OpenStack +author-email = openstack-dev@lists.openstack.org +home-page = http://www.openstack.org/ +classifier = + Development Status :: 5 - Production/Stable + 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 + +[pbr] +skip_authors = True +skip_changelog = True + +[files] +packages = + swauth +scripts = + bin/swauth-add-account + bin/swauth-add-user + bin/swauth-cleanup-tokens + bin/swauth-delete-account + bin/swauth-delete-user + bin/swauth-list + bin/swauth-prep + bin/swauth-set-account-service + +[entry_points] +paste.filter_factory = + swauth = swauth.middleware:filter_factory + [build_sphinx] all_files = 1 build-dir = doc/build diff --git a/setup.py b/setup.py index 5ca4924..056c16c 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ -#!/usr/bin/python -# Copyright (c) 2010-2011 OpenStack, LLC. +# 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. @@ -14,76 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -from setuptools import setup, find_packages -from setuptools.command.sdist import sdist -import os -import subprocess +# 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: - from babel.messages import frontend + import multiprocessing # noqa except ImportError: - frontend = None + pass -from swauth import __version__ as version - - -class local_sdist(sdist): - """Customized sdist hook - builds the ChangeLog file from VC first""" - - def run(self): - if os.path.isdir('.bzr'): - # We're in a bzr branch - - log_cmd = subprocess.Popen(["bzr", "log", "--gnu"], - stdout=subprocess.PIPE) - changelog = log_cmd.communicate()[0] - with open("ChangeLog", "w") as changelog_file: - changelog_file.write(changelog) - sdist.run(self) - - -name = 'swauth' - - -cmdclass = {'sdist': local_sdist} - - -if frontend: - cmdclass.update({ - 'compile_catalog': frontend.compile_catalog, - 'extract_messages': frontend.extract_messages, - 'init_catalog': frontend.init_catalog, - 'update_catalog': frontend.update_catalog, - }) - - -setup( - name=name, - version=version, - description='Swauth', - license='Apache License (2.0)', - author='OpenStack, LLC.', - author_email='swauth@brim.net', - url='https://github.com/openstack/swauth', - packages=find_packages(exclude=['test_swauth', 'bin']), - test_suite='nose.collector', - cmdclass=cmdclass, - classifiers=[ - 'Development Status :: 4 - Beta', - 'License :: OSI Approved :: Apache Software License', - 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python :: 2.6', - 'Environment :: No Input/Output (Daemon)', - ], - install_requires=[], # removed for better compat - scripts=[ - 'bin/swauth-add-account', 'bin/swauth-add-user', - 'bin/swauth-cleanup-tokens', 'bin/swauth-delete-account', - 'bin/swauth-delete-user', 'bin/swauth-list', 'bin/swauth-prep', - 'bin/swauth-set-account-service', - ], - entry_points={ - 'paste.filter_factory': [ - 'swauth=swauth.middleware:filter_factory', - ], - }, - ) +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt index 8ed2d4b..12fe1ce 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,7 +6,7 @@ hacking<0.11,>=0.10.0 flake8 mock nose -#coverage>=3.6 +coverage>=3.6 #discover #python-subunit>=0.0.18 sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 diff --git a/test_swauth/__init__.py b/test/__init__.py similarity index 100% rename from test_swauth/__init__.py rename to test/__init__.py diff --git a/test_swauth/unit/__init__.py b/test/unit/__init__.py similarity index 100% rename from test_swauth/unit/__init__.py rename to test/unit/__init__.py diff --git a/test_swauth/unit/test_authtypes.py b/test/unit/test_authtypes.py similarity index 100% rename from test_swauth/unit/test_authtypes.py rename to test/unit/test_authtypes.py diff --git a/test_swauth/unit/test_middleware.py b/test/unit/test_middleware.py similarity index 100% rename from test_swauth/unit/test_middleware.py rename to test/unit/test_middleware.py diff --git a/tox.ini b/tox.ini index 4536443..5070340 100644 --- a/tox.ini +++ b/tox.ini @@ -7,23 +7,28 @@ skipsdist = True basepython = python2.7 usedevelop = True install_command = pip install -U {opts} {packages} -setenv = - VIRTUAL_ENV={envdir} +setenv = VIRTUAL_ENV={envdir} + NOSE_WITH_COVERAGE=1 + NOSE_COVER_BRANCHES=1 deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt https://launchpad.net/swift/kilo/2.3.0/+download/swift-2.3.0.tar.gz -commands = python setup.py test +commands = nosetests {posargs:test/unit} + +[testenv:cover] +setenv = VIRTUAL_ENV={envdir} + NOSE_WITH_COVERAGE=1 + NOSE_COVER_BRANCHES=1 + NOSE_COVER_HTML=1 + NOSE_COVER_HTML_DIR={toxinidir}/cover [testenv:pep8] -commands = flake8 swauth test_swauth +commands = flake8 swauth test [testenv:venv] commands = {posargs} -#[testenv:cover] -#commands = python setup.py test --coverage - [testenv:docs] commands = python setup.py build_sphinx