| 1 |
#!/usr/bin/env python |
| 2 |
|
| 3 |
# This program is free software; you can redistribute it and/or modify |
| 4 |
# it under the terms of the GNU General Public License as published by |
| 5 |
# the Free Software Foundation; either version 3 of the License, or |
| 6 |
# (at your option) any later version. |
| 7 |
# |
| 8 |
# This program is distributed in the hope that it will be useful, |
| 9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
# GNU General Public License for more details. |
| 12 |
# |
| 13 |
# You should have received a copy of the GNU General Public License |
| 14 |
# along with this program; if not, write to the Free Software |
| 15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 16 |
|
| 17 |
import os |
| 18 |
import sys |
| 19 |
|
| 20 |
from setuptools import find_packages, setup |
| 21 |
|
| 22 |
py_version = sys.version_info[:2] |
| 23 |
|
| 24 |
if py_version < (3, 8): |
| 25 |
raise RuntimeError("Errbot requires Python 3.8 or later") |
| 26 |
|
| 27 |
VERSION_FILE = os.path.join("errbot", "version.py") |
| 28 |
|
| 29 |
deps = [ |
| 30 |
"webtest==3.0.0", |
| 31 |
"setuptools==68.1.2", |
| 32 |
"flask==2.3.3", |
| 33 |
"requests==2.31.0", |
| 34 |
"jinja2==3.1.2", |
| 35 |
"pyOpenSSL==23.2.0", |
| 36 |
"colorlog==6.7.0", |
| 37 |
"markdown==3.4.4", |
| 38 |
"ansi==0.3.6", |
| 39 |
"Pygments==2.16.1", |
| 40 |
"pygments-markdown-lexer==0.1.0.dev39", # sytax coloring to debug md |
| 41 |
"dulwich==0.21.5", # python implementation of git |
| 42 |
"deepmerge==1.1.0", |
| 43 |
] |
| 44 |
|
| 45 |
if py_version < (3, 9): |
| 46 |
deps.append("graphlib-backport==1.0.3") |
| 47 |
|
| 48 |
src_root = os.curdir |
| 49 |
|
| 50 |
|
| 51 |
def read_version(): |
| 52 |
""" |
| 53 |
Read directly the errbot/version.py and gives the version without loading Errbot. |
| 54 |
:return: errbot.version.VERSION |
| 55 |
""" |
| 56 |
|
| 57 |
variables = {} |
| 58 |
with open(VERSION_FILE) as f: |
| 59 |
exec(compile(f.read(), "version.py", "exec"), variables) |
| 60 |
return variables["VERSION"] |
| 61 |
|
| 62 |
|
| 63 |
def read(fname, encoding="ascii"): |
| 64 |
return open( |
| 65 |
os.path.join(os.path.dirname(__file__), fname), "r", encoding=encoding |
| 66 |
).read() |
| 67 |
|
| 68 |
|
| 69 |
if __name__ == "__main__": |
| 70 |
|
| 71 |
VERSION = read_version() |
| 72 |
|
| 73 |
args = set(sys.argv) |
| 74 |
|
| 75 |
changes = read("CHANGES.rst", "utf8") |
| 76 |
|
| 77 |
if changes.find(VERSION) == -1: |
| 78 |
raise Exception("You forgot to put a release note in CHANGES.rst ?!") |
| 79 |
|
| 80 |
if args & {"bdist", "bdist_dumb", "bdist_rpm", "bdist_wininst", "bdist_msi"}: |
| 81 |
raise Exception("err doesn't support binary distributions") |
| 82 |
|
| 83 |
packages = find_packages(src_root, include=["errbot", "errbot.*"]) |
| 84 |
|
| 85 |
setup( |
| 86 |
name="errbot", |
| 87 |
version=VERSION, |
| 88 |
packages=packages, |
| 89 |
entry_points={ |
| 90 |
"console_scripts": [ |
| 91 |
"errbot = errbot.cli:main", |
| 92 |
] |
| 93 |
}, |
| 94 |
install_requires=deps, |
| 95 |
tests_require=["nose", "webtest", "requests"], |
| 96 |
package_data={ |
| 97 |
"errbot": [ |
| 98 |
"backends/*.plug", |
| 99 |
"backends/*.html", |
| 100 |
"backends/styles/*.css", |
| 101 |
"backends/images/*.svg", |
| 102 |
"core_plugins/*.plug", |
| 103 |
"core_plugins/*.md", |
| 104 |
"core_plugins/templates/*.md", |
| 105 |
"storage/*.plug", |
| 106 |
"templates/initdir/example.py", |
| 107 |
"templates/initdir/example.plug", |
| 108 |
"templates/initdir/config.py.tmpl", |
| 109 |
"templates/*.md", |
| 110 |
"templates/new_plugin.py.tmpl", |
| 111 |
], |
| 112 |
}, |
| 113 |
extras_require={ |
| 114 |
"slack": [ |
| 115 |
"errbot-backend-slackv3==0.2.1", |
| 116 |
], |
| 117 |
"discord": [ |
| 118 |
"err-backend-discord==3.0.1", |
| 119 |
], |
| 120 |
"mattermost": [ |
| 121 |
"err-backend-mattermost==3.0.0", |
| 122 |
], |
| 123 |
"IRC": [ |
| 124 |
"irc==20.3.0", |
| 125 |
], |
| 126 |
"telegram": [ |
| 127 |
"python-telegram-bot==13.15", |
| 128 |
], |
| 129 |
"XMPP": [ |
| 130 |
"slixmpp==1.8.4", |
| 131 |
"pyasn1==0.5.0", |
| 132 |
"pyasn1-modules==0.3.0", |
| 133 |
], |
| 134 |
':sys_platform!="win32"': ["daemonize==2.5.0"], |
| 135 |
}, |
| 136 |
author="errbot.io", |
| 137 |
author_email="[email protected]", |
| 138 |
description="Errbot is a chatbot designed to be simple to extend with plugins written in Python.", |
| 139 |
long_description_content_type="text/x-rst", |
| 140 |
long_description="".join([read("README.rst"), "\n\n", changes]), |
| 141 |
license="GPL", |
| 142 |
keywords="xmpp irc slack hipchat gitter tox chatbot bot plugin chatops", |
| 143 |
url="http://errbot.io/", |
| 144 |
classifiers=[ |
| 145 |
"Development Status :: 5 - Production/Stable", |
| 146 |
"Topic :: Communications :: Chat", |
| 147 |
"Topic :: Communications :: Chat :: Internet Relay Chat", |
| 148 |
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", |
| 149 |
"Operating System :: OS Independent", |
| 150 |
"Programming Language :: Python :: 3", |
| 151 |
"Programming Language :: Python :: 3.8", |
| 152 |
"Programming Language :: Python :: 3.9", |
| 153 |
"Programming Language :: Python :: 3.10", |
| 154 |
], |
| 155 |
src_root=src_root, |
| 156 |
platforms="any", |
| 157 |
) |