summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Page <james.page@ubuntu.com>2017-03-10 11:35:41 +0000
committerJames Page <james.page@ubuntu.com>2017-03-10 11:35:41 +0000
commit195d002ab17846e1cebb8ca384cc3a9a79ee5ec9 (patch)
tree2b4d5967e0139863132dcbd649638daab753f46a
parent0e0e3933e363d10e6d7569682c14a881bd8ae238 (diff)
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
Notes
Notes (review): Code-Review+2: Chris MacNaughton <chris.macnaughton@canonical.com> Code-Review+2: James Page <james.page@canonical.com> Workflow+1: James Page <james.page@canonical.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Fri, 10 Mar 2017 11:46:31 +0000 Reviewed-on: https://review.openstack.org/444231 Project: openstack/charms.ceph Branch: refs/heads/master
-rw-r--r--setup.py79
-rw-r--r--tox.ini5
2 files changed, 83 insertions, 1 deletions
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..f5d5911
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,79 @@
1# -*- coding: utf-8 -*-
2from __future__ import print_function
3
4import sys
5from setuptools import setup, find_packages
6from setuptools.command.test import test as TestCommand
7
8version = "0.0.1.dev1"
9install_require = [
10]
11
12tests_require = [
13 'tox >= 2.3.1',
14]
15
16class Tox(TestCommand):
17 user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
18 def initialize_options(self):
19 TestCommand.initialize_options(self)
20 self.tox_args = None
21 def finalize_options(self):
22 TestCommand.finalize_options(self)
23 self.test_args = []
24 self.test_suite = True
25 def run_tests(self):
26 #import here, cause outside the eggs aren't loaded
27 import tox
28 import shlex
29 args = self.tox_args
30 # remove the 'test' arg from argv as tox passes it to ostestr which
31 # breaks it.
32 sys.argv.pop()
33 if args:
34 args = shlex.split(self.tox_args)
35 errno = tox.cmdline(args=args)
36 sys.exit(errno)
37
38
39if sys.argv[-1] == 'publish':
40 os.system("python setup.py sdist upload")
41 os.system("python setup.py bdist_wheel upload")
42 sys.exit()
43
44
45if sys.argv[-1] == 'tag':
46 os.system("git tag -a %s -m 'version %s'" % (version, version))
47 os.system("git push --tags")
48 sys.exit()
49
50
51setup(
52 name='charms.ceph',
53 version=version,
54 description='Provide base module for ceph charms.',
55 classifiers=[
56 "Development Status :: 2 - Pre-Alpha",
57 "Intended Audience :: Developers",
58 "Topic :: System",
59 "Topic :: System :: Installation/Setup",
60 "Topic :: System :: Software Distribution",
61 "Programming Language :: Python :: 2",
62 "Programming Language :: Python :: 2.7",
63 "Programming Language :: Python :: 3",
64 "Programming Language :: Python :: 3.5",
65 "License :: OSI Approved :: Apache Software License",
66 ],
67 url='https://github.com/openstack/charms.ceph',
68 author='OpenStack Charmers',
69 author_email='openstack-dev@lists.openstack.org',
70 license='Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0',
71 packages=find_packages(exclude=["unit_tests"]),
72 zip_safe=False,
73 cmdclass = {'test': Tox},
74 install_requires=install_require,
75 extras_require={
76 'testing': tests_require,
77 },
78 tests_require=tests_require,
79)
diff --git a/tox.ini b/tox.ini
index cc18059..c469224 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,8 +7,11 @@ setenv = VIRTUAL_ENV={envdir}
7 PYTHONHASHSEED=0 7 PYTHONHASHSEED=0
8install_command = 8install_command =
9 pip install --allow-unverified python-apt {opts} {packages} 9 pip install --allow-unverified python-apt {opts} {packages}
10commands = ostestr {posargs} 10commands = find . -type f -name "*.py[c|o]" -delete
11 find . -type d -name "__pycache__" -delete
12 ostestr {posargs}
11sitepackages = False 13sitepackages = False
14whitelist_externals = find
12 15
13[testenv:py27] 16[testenv:py27]
14basepython = python2.7 17basepython = python2.7