1
0
mirror of https://github.com/Yubico/yubiadmin.git synced 2025-02-27 08:54:15 +01:00
yubiadmin/setup.py

123 lines
4.4 KiB
Python
Raw Normal View History

2013-04-23 13:45:53 +02:00
#!/usr/bin/python
2013-04-30 09:45:33 +02:00
2013-04-23 13:45:53 +02:00
# Copyright (c) 2013 Yubico AB
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
from setuptools import setup
2013-05-02 10:46:02 +02:00
from distutils.core import Command
from distutils.errors import DistutilsSetupError
import os
import re
from datetime import date
class release(Command):
description = "create and release a new version"
user_options = [
('keyid', None, "GPG key to sign with"),
2013-05-02 10:51:02 +02:00
('skip-tests', None, "skip running the tests"),
2013-05-02 10:46:02 +02:00
]
2013-05-02 10:51:02 +02:00
boolean_options = ['skip-tests']
2013-05-02 10:46:02 +02:00
def initialize_options(self):
self.cwd = None
self.keyid = None
self.skip_tests = 0
def finalize_options(self):
self.cwd = os.getcwd()
def run(self):
if os.getcwd() != self.cwd:
raise DistutilsSetupError("Must be in package root!")
version = self.distribution.get_version()
fullname = self.distribution.get_fullname()
tag_exists = os.system('git tag | grep -q "^%s\$"' % fullname) == 0
if tag_exists:
raise DistutilsSetupError("Tag '%s' already exists!" % fullname)
with open('NEWS', 'r') as news_file:
line = news_file.readline()
now = date.today().strftime('%Y-%m-%d')
if not re.search(r'Version %s \(released %s\)' % (version, now), line):
raise DistutilsSetupError("Incorrect date/version in NEWS!")
self.execute(os.system, ('git2cl > ChangeLog',))
if not self.skip_tests:
self.run_command('check')
self.run_command('test')
self.run_command('sdist') # upload --sign --identity keyid
sign_opts = ['--detach-sign', 'dist/%s.tar.gz' % fullname]
if self.keyid:
sign_opts.insert(1, '--default-key ' + self.keyid)
self.execute(os.system, ('gpg ' + (' '.join(sign_opts)),))
verify = os.system('gpg --verify dist/%s.tar.gz.sig' % fullname) == 0
if not verify:
raise DistutilsSetupError("Error verifying signature!")
tag_opts = ['-s' '-m ' + fullname, fullname]
if self.keyid:
tag_opts[0] = '-u ' + self.keyid
self.execute(os.system, ('git tag ' + (' '.join(tag_opts)),))
2013-04-23 13:45:53 +02:00
setup(
name='yubiadmin',
2013-05-02 10:47:53 +02:00
version='0.0.6',
2013-04-23 13:45:53 +02:00
author='Dain Nilsson',
author_email='dain@yubico.com',
maintainer='Yubico Open Source Maintainers',
maintainer_email='ossmaint@yubico.com',
url='https://github.com/Yubico/yubiadmin',
license='BSD 2 clause',
2013-04-26 12:13:33 +02:00
packages=['yubiadmin', 'yubiadmin.apps', 'yubiadmin.util'],
2013-04-29 14:09:30 +02:00
include_package_data=True,
scripts=['bin/yubiadmin-server'],
2013-04-23 13:45:53 +02:00
setup_requires=['nose>=1.0'],
2013-04-26 12:13:33 +02:00
install_requires=['webob', 'Jinja2', 'WTForms'],
2013-04-23 13:45:53 +02:00
test_suite='nose.collector',
tests_require=[''],
2013-05-02 10:46:02 +02:00
cmdclass={'release': release},
2013-04-23 13:45:53 +02:00
classifiers=[
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Development Status :: 2 - Pre-Alpha',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
]
)