-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
135 lines (112 loc) · 3.99 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
"""A setuptools based setup module."""
# To use a consistent encoding
import codecs
import os
# setup
import setuptools
# a fix for behave_test in behave 1.2.5
import shlex
import subprocess
import sys
# noinspection PyPep8Naming
from setuptools.command.test import test as TestCommand
__author__ = 'Tomasz J. Kotarba <[email protected]>'
__copyright__ = 'Copyright (c) 2016, Tomasz J. Kotarba. All rights reserved.'
__maintainer__ = 'Tomasz J. Kotarba'
__email__ = '[email protected]'
# a fix for behave_test in behave 1.2.5
class BehaveTest(TestCommand):
user_options = [('behave-args=', 'b', 'Arguments to pass to behave')]
# noinspection PyAttributeOutsideInit
def initialize_options(self):
TestCommand.initialize_options(self)
self.behave_args = []
#import here, cause outside the egg is not loaded
from setuptools_behave import behave_test
class _BehaveTest(behave_test):
def behave(self, path):
behave = os.path.join("bin", "behave")
if not os.path.exists(behave):
behave = "-m behave"
cmd_options = self.distribution.command_options[
'behave_test'].get('behave_args', ['', ''])[1]
self.announce("CMDLINE: python %s %s" % (behave, cmd_options),
level=3)
behave_cmd = shlex.split(behave)
return subprocess.call(
[sys.executable] + behave_cmd + shlex.split(cmd_options))
self.behave_command = _BehaveTest(self.distribution)
def finalize_options(self):
self.behave_command.finalize_options()
def run(self):
self.behave_command.run()
class PyTest(TestCommand):
user_options = [('pytest-args=', 'p', "Arguments to pass to pytest")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = ''
def run_tests(self):
import shlex
import pytest
errno = pytest.main(shlex.split(self.pytest_args))
sys.exit(errno)
install_requires = [
'docopt>=0.6,<1',
'rapidpro-python>=2.1.1,<3',
'sqlalchemy>=1.1.3,<2',
]
tests_require = [
'PyHamcrest>=1.9,<2',
'behave>=1.2.5,<2',
'iocapture>=0.1.2,<1',
'mock>=2,<3',
'pretenders>=1.4.2,<2',
'pytest>=3,<4',
'pytest-cov>=2.4,<3',
'pytz>=2016.7',
'tox-travis',
]
here = os.path.abspath(os.path.dirname(__file__))
# Get the long description from the README.rst file
with codecs.open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setuptools.setup(
name='rapidpro-pull',
version='1.0.3',
description='An open-source tool to pull and cache data from RapidPro'
' servers.',
long_description=long_description,
url='https://github.com/system7-open-source/rapidpro-pull',
author='Tomasz J. Kotarba',
author_email='[email protected]',
license='GPLv3+',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: System Administrators',
'Topic :: Desktop Environment',
'Topic :: Internet',
'Topic :: Utilities',
'Operating System :: OS Independent',
'License :: OSI Approved :: GNU General Public License v3 or later '
'(GPLv3+)',
'Environment :: Console',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
],
keywords='rapidpro',
package_dir={'': '.'},
packages=setuptools.find_packages('.', exclude=['features', 'spec']),
python_requires='>=2.7,!=3.*',
setup_requires=['behave>=1.2.5,<2'],
install_requires=install_requires,
tests_require=tests_require,
extras_require={'development': tests_require},
entry_points={
'console_scripts': [
'rapidpro-pull = rapidpropull.cli:main',
],
},
cmdclass={'behave_test': BehaveTest,
'pytest': PyTest},
)