-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
91 lines (70 loc) · 2.36 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# -*- coding: utf-8 -*-
# Copyright 2016-TODAY LasLabs Inc.
# License MIT (https://opensource.org/licenses/MIT).
from setuptools import Command, setup
from setuptools import find_packages
from unittest import TestLoader, TextTestRunner
from os import environ, path
PROJECT = 'carepoint'
SHORT_DESC = (
'This library will allow you to interact with a remote CarePoint '
'instance using Python.'
)
README_FILE = 'README.rst'
version = environ.get('RELEASE') or environ.get('VERSION') or '0.0.0'
if environ.get('TRAVIS_BUILD_NUMBER'):
version += 'b%s' % environ.get('TRAVIS_BUILD_NUMBER')
setup_vals = {
'name': PROJECT,
'author': 'LasLabs Inc.',
'author_email': 'support@laslabs.com',
'description': SHORT_DESC,
'url': 'https://laslabs.github.io/python-%s' % PROJECT,
'download_url': 'https://github.com/LasLabs/python-%s' % PROJECT,
'license': 'MIT',
'classifiers': [
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Healthcare Industry',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
],
'version': version,
}
if path.exists(README_FILE):
with open(README_FILE) as fh:
setup_vals['long_description'] = fh.read()
install_requires = []
if path.exists('requirements.txt'):
with open('requirements.txt') as fh:
install_requires = fh.read().splitlines()
class FailTestException(Exception):
""" It provides a failing build """
pass
class Tests(Command):
''' Run test & coverage, save reports as XML '''
user_options = [] # < For Command API compatibility
def initialize_options(self, ):
pass
def finalize_options(self, ):
pass
def run(self, ):
loader = TestLoader()
tests = loader.discover('.', 'test_*.py')
t = TextTestRunner(verbosity=1)
res = t.run(tests)
if not res.wasSuccessful():
raise FailTestException()
if __name__ == "__main__":
setup(
packages=find_packages(exclude=('tests')),
cmdclass={'test': Tests},
tests_require=[
'mock',
],
install_requires=install_requires,
**setup_vals
)