From 8f1c6528629f662458865d2a90841055bb6f57e9 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 6 Dec 2013 17:31:02 +0200 Subject: [PATCH] Migrate to pbr OpenStack uses pbr for setuptools/build and version releases. As barbican looks towards incubation, migrate to being pbr based. Change-Id: I3c7a389596ca579a5613ea98b21cdc6967e49cc7 --- .gitignore | 2 + Authors | 2 - barbican/version.py | 13 +--- bin/barbican.sh | 4 +- tools/pip-requires => requirements.txt | 2 + setup.cfg | 34 +++++++++ setup.py | 78 ++------------------ tools/test-requires => test-requirements.txt | 5 +- tools/install_venv.py | 4 +- tox.ini | 17 ++--- 10 files changed, 60 insertions(+), 101 deletions(-) delete mode 100644 Authors rename tools/pip-requires => requirements.txt (96%) rename tools/test-requires => test-requirements.txt (54%) diff --git a/.gitignore b/.gitignore index df2fc2749..6422b7086 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,5 @@ versiononly.txt *.orig myapp.profile *.out.myapp +AUTHORS +ChangeLog diff --git a/Authors b/Authors deleted file mode 100644 index cf0086db9..000000000 --- a/Authors +++ /dev/null @@ -1,2 +0,0 @@ -John Wood - diff --git a/barbican/version.py b/barbican/version.py index 7006c589b..33307550d 100644 --- a/barbican/version.py +++ b/barbican/version.py @@ -13,14 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -""" -Cloudkeep's Barbican version. +import pbr.version -The code repository should only control major and minor version information in -this file. Per-build information will be supplied at build time via the -'build_id' and 'commit_id' parameters. -""" - -__version__ = '2013.2.{build_id}' -__version_info__ = tuple(__version__.split('.')) -__version_commit__ = '{commit_id}' +version_info = pbr.version.VersionInfo('barbican') +__version__ = version_info.version_string() diff --git a/bin/barbican.sh b/bin/barbican.sh index 434745aec..dd01336e6 100755 --- a/bin/barbican.sh +++ b/bin/barbican.sh @@ -49,8 +49,8 @@ install_barbican() fi # Install Python dependencies - pip install -r tools/pip-requires - pip install -r tools/test-requires + pip install -r requirements.txt + pip install -r test-requirements.txt # Install uWSGI pip install uwsgi diff --git a/tools/pip-requires b/requirements.txt similarity index 96% rename from tools/pip-requires rename to requirements.txt index 464e47b26..b1206e847 100644 --- a/tools/pip-requires +++ b/requirements.txt @@ -1,3 +1,5 @@ +pbr>=0.5.21,<1.0 + falcon>=0.1.1 wsgiref>=0.1.2 pysqlite>=2.6.0 diff --git a/setup.cfg b/setup.cfg index 41d62b4da..23ce1af67 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,37 @@ +[metadata] +name = barbican +version = 2014.1 +description = Service for storing sensitive client information for OpenStack +description-file = + README.md +author = OpenStack +author-email = openstack-dev@lists.openstack.org +home-page = http://www.openstack.org/ +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 + +[files] +packages = + barbican +scripts = + bin/barbican.sh + bin/barbican-worker.py + +[entry_points] +barbican.crypto.plugin = + p11_crypto = barbican.crypto.p11_crypto:P11CryptoPlugin + simple_crypto = barbican.crypto.plugin:SimpleCryptoPlugin +barbican.test.crypto.plugin = + test_crypto = barbican.tests.crypto.test_plugin:TestCryptoPlugin + [build_sphinx] all_files = 1 build-dir = doc/build diff --git a/setup.py b/setup.py index f2db1d56e..70c2b3f32 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,11 @@ -#!/usr/bin/python -# Copyright (c) 2010 OpenStack, LLC. +#!/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 +# 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, @@ -14,71 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os -try: - from setuptools import setup, find_packages - from setuptools.command.sdist import sdist -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, find_packages - from setuptools.command.sdist import sdist +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools -# Determine version of this application. -# TBD: Revisit version flows and processing once integrating with OpenStack, -# see glance setup.py -PKG = "barbican" -VERSIONFILE = os.path.join(PKG, "version.py") -version = "unknown" -try: - version_file = open(VERSIONFILE, "r") - for line in version_file: - if '__version__' in line: - version = line.split("'")[1] - break -except EnvironmentError: - pass # Okay, there is no version file. - - -class local_sdist(sdist): - """Customized sdist hook - builds the ChangeLog file from VC first""" - - def run(self): - sdist.run(self) - -cmdclass = {'sdist': local_sdist} - -# TDB: Revisit sphinx documentation needs once move to OpenStack... -# see barbican setup.py - -setup( - name='barbican', - version=version, - description='The Barbican project provides a service for storing ' - 'sensitive client information such as encryption keys', - license='Apache License (2.0)', - author='OpenStack', - author_email='john.wood@rackspace.com', - url='http://barbican.openstack.org/', - packages=find_packages(exclude=['bin']), - test_suite='nose.collector', - cmdclass=cmdclass, - include_package_data=True, - classifiers=[ - 'Development Status :: 4 - Beta', - 'License :: OSI Approved :: Apache Software License', - 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python :: 2.7', - 'Environment :: No Input/Output (Daemon)', - ], - scripts=['bin/barbican.sh', 'bin/barbican-worker.py'], - py_modules=[], - entry_points=""" - [barbican.crypto.plugin] - p11_crypto = barbican.crypto.p11_crypto:P11CryptoPlugin - simple_crypto = barbican.crypto.plugin:SimpleCryptoPlugin - - [barbican.test.crypto.plugin] - test_crypto = barbican.tests.crypto.test_plugin:TestCryptoPlugin - """ -) +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/tools/test-requires b/test-requirements.txt similarity index 54% rename from tools/test-requires rename to test-requirements.txt index ca81ec01d..8865539fa 100644 --- a/tools/test-requires +++ b/test-requirements.txt @@ -1,7 +1,4 @@ -hacking +hacking>=0.5.6,<0.8 mock>=1.0.0 nose nosexcover -testtools -tox - diff --git a/tools/install_venv.py b/tools/install_venv.py index 587379586..ed983214e 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -51,8 +51,8 @@ def print_help(): def main(argv): root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) venv = os.path.join(root, '.venv') - pip_requires = os.path.join(root, 'tools', 'pip-requires') - test_requires = os.path.join(root, 'tools', 'test-requires') + pip_requires = os.path.join(root, 'requirements.txt') + test_requires = os.path.join(root, 'test-requirements.txt') py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1]) project = 'Barbican' project_name = "barbican.pth" diff --git a/tox.ini b/tox.ini index 3f07eeaa4..e367a16d6 100644 --- a/tox.ini +++ b/tox.ini @@ -5,16 +5,11 @@ envlist = pep8,pyflakes,py27 setenv = VIRTUAL_ENV={envdir} PYTHONPATH = {toxinidir}/etc/barbican -deps = -r{toxinidir}/tools/pip-requires - -r{toxinidir}/tools/test-requires - -[testenv:pyflakes] -deps = pyflakes -commands = pyflakes barbican setup.py +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt [testenv:pep8] -deps = pep8 -commands = pep8 barbican --ignore=E711 --count --repeat --show-source --exclude=.tox setup.py +commands = flake8 [testenv:py27] commands = nosetests {posargs:--with-xcoverage --all-modules --cover-inclusive --traverse-namespace --with-xunit --cover-package=barbican} @@ -22,8 +17,8 @@ commands = nosetests {posargs:--with-xcoverage --all-modules --cover-inclusive - [testenv:coverage] commands = coverage html {posargs:--include="*barbican*"} -[testenv:hacking] -commands = {toxinidir}/tools/hacking.sh - [flake8] +# E711 ignored because of sqlalchemy override of == None +# H ignored because it's not H clean +ignore = E711,H exclude = .git,.idea,.tox,bin,dist,debian,rpmbuild,tools,*.egg-info,*openstack/common