Add setup.py for use as python module
charms.ceph is not currently installable using pip; add required setup.py file to ensure it can be consumed in this way. Change-Id: Ife1828213d01eed541153089eef0b93efb941a57
This commit is contained in:
parent
0e0e3933e3
commit
195d002ab1
|
@ -0,0 +1,79 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools.command.test import test as TestCommand
|
||||
|
||||
version = "0.0.1.dev1"
|
||||
install_require = [
|
||||
]
|
||||
|
||||
tests_require = [
|
||||
'tox >= 2.3.1',
|
||||
]
|
||||
|
||||
class Tox(TestCommand):
|
||||
user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
|
||||
def initialize_options(self):
|
||||
TestCommand.initialize_options(self)
|
||||
self.tox_args = None
|
||||
def finalize_options(self):
|
||||
TestCommand.finalize_options(self)
|
||||
self.test_args = []
|
||||
self.test_suite = True
|
||||
def run_tests(self):
|
||||
#import here, cause outside the eggs aren't loaded
|
||||
import tox
|
||||
import shlex
|
||||
args = self.tox_args
|
||||
# remove the 'test' arg from argv as tox passes it to ostestr which
|
||||
# breaks it.
|
||||
sys.argv.pop()
|
||||
if args:
|
||||
args = shlex.split(self.tox_args)
|
||||
errno = tox.cmdline(args=args)
|
||||
sys.exit(errno)
|
||||
|
||||
|
||||
if sys.argv[-1] == 'publish':
|
||||
os.system("python setup.py sdist upload")
|
||||
os.system("python setup.py bdist_wheel upload")
|
||||
sys.exit()
|
||||
|
||||
|
||||
if sys.argv[-1] == 'tag':
|
||||
os.system("git tag -a %s -m 'version %s'" % (version, version))
|
||||
os.system("git push --tags")
|
||||
sys.exit()
|
||||
|
||||
|
||||
setup(
|
||||
name='charms.ceph',
|
||||
version=version,
|
||||
description='Provide base module for ceph charms.',
|
||||
classifiers=[
|
||||
"Development Status :: 2 - Pre-Alpha",
|
||||
"Intended Audience :: Developers",
|
||||
"Topic :: System",
|
||||
"Topic :: System :: Installation/Setup",
|
||||
"Topic :: System :: Software Distribution",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
],
|
||||
url='https://github.com/openstack/charms.ceph',
|
||||
author='OpenStack Charmers',
|
||||
author_email='openstack-dev@lists.openstack.org',
|
||||
license='Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0',
|
||||
packages=find_packages(exclude=["unit_tests"]),
|
||||
zip_safe=False,
|
||||
cmdclass = {'test': Tox},
|
||||
install_requires=install_require,
|
||||
extras_require={
|
||||
'testing': tests_require,
|
||||
},
|
||||
tests_require=tests_require,
|
||||
)
|
5
tox.ini
5
tox.ini
|
@ -7,8 +7,11 @@ setenv = VIRTUAL_ENV={envdir}
|
|||
PYTHONHASHSEED=0
|
||||
install_command =
|
||||
pip install --allow-unverified python-apt {opts} {packages}
|
||||
commands = ostestr {posargs}
|
||||
commands = find . -type f -name "*.py[c|o]" -delete
|
||||
find . -type d -name "__pycache__" -delete
|
||||
ostestr {posargs}
|
||||
sitepackages = False
|
||||
whitelist_externals = find
|
||||
|
||||
[testenv:py27]
|
||||
basepython = python2.7
|
||||
|
|
Loading…
Reference in New Issue