forked from errbotio/errbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·147 lines (119 loc) · 4.85 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
136
137
138
139
140
141
142
143
144
145
146
147
#!/usr/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import os
import sys
from platform import system
from setuptools import setup, find_packages
py_version = sys.version_info[:2]
PY2 = py_version[0] == 2
PY3 = not PY2
PY35_OR_GREATER = py_version[:2] >= (3, 5)
ON_WINDOWS = system() == 'Windows'
if py_version < (2, 7):
raise RuntimeError('Err requires Python 2.7 or later')
if PY3 and py_version < (3, 3):
raise RuntimeError('On Python 3, Err requires Python 3.3 or later')
deps = ['webtest',
'setuptools',
'bottle',
'requests',
'jinja2',
'pyOpenSSL',
'colorlog',
'yapsy>=1.11', # new contract for plugin instantiation
'markdown', # rendering stuff
'ansi',
'Pygments>=2.0.2',
'pygments-markdown-lexer>=0.1.0.dev39', # sytax coloring to debug md
]
if PY2:
deps += ['dnspython', # dnspython is needed for SRV records
'config',
'backports.functools_lru_cache']
else:
deps += ['dnspython3', ] # dnspython3 for SRV records
if not PY35_OR_GREATER:
deps += ['typing', ] # backward compatibility for 3.3 and 3.4
# Extra dependencies for a development environment.
# if 'develop' in sys.argv: <- we cannot do that as pip is doing that in 2 steps.
# TODO(gbin): find another way to filter those out if we don't need them.
deps += ['mock',
'nose',
'pep8',
# Order matters here, pytest must come last. See also:
# https://github.com/gbin/err/pull/496
# https://bitbucket.org/pypa/setuptools/issues/196/tests_require-pytest-pytest-cov-breaks
'pytest-xdist',
'pytest',
'PyOpenSSL']
if not ON_WINDOWS:
deps += ['daemonize']
src_root = os.curdir
sys.path.insert(0, os.path.join(src_root, 'errbot')) # hack to avoid loading err machinery from the errbot package
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
if __name__ == "__main__":
from version import VERSION
args = set(sys.argv)
changes = read('CHANGES.rst')
if changes.find(VERSION) == -1:
raise Exception('You forgot to put a release note in CHANGES.rst ?!')
if args & {'bdist', 'bdist_dumb', 'bdist_rpm', 'bdist_wininst', 'bdist_msi'}:
raise Exception("err doesn't support binary distributions")
# under python2 if we want to make a source distribution,
# don't pre-convert the sources, leave them as py3.
if PY2 and args & {'install', 'develop', 'bdist_wheel'}:
from py2conv import convert_to_python2
convert_to_python2()
setup(
name="err",
version=VERSION,
packages=find_packages(src_root, exclude=['tests', 'tools']),
entry_points={
'console_scripts': [
'errbot = errbot.err:main',
'err.py = errbot.err:main'
]
},
install_requires=deps,
tests_require=['nose', 'webtest', 'requests'],
package_data={
'': ['*.txt', '*.rst', '*.plug', '*.md'],
},
author="Guillaume BINET",
author_email="[email protected]",
description="Err is a chatbot designed to be simple to extend with plugins written in Python.",
long_description=''.join([read('README.rst'), '\n\n', changes]),
license="GPL",
keywords="xmpp irc slack hipchat gitter tox chatbot bot plugin chatops",
url="http://errbot.net/",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Topic :: Communications :: Chat",
"Topic :: Communications :: Chat :: Internet Relay Chat",
"Topic :: Communications :: Conferencing",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
],
src_root=src_root,
platforms='any',
)
# restore the paths
sys.path.remove(os.path.join(src_root, 'errbot'))