2020-04-03 05:11:02 -04:00
|
|
|
#!/usr/bin/env python3
|
2017-07-18 00:01:54 -04:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import sys
|
2017-10-11 01:55:18 -04:00
|
|
|
if False:
|
|
|
|
from typing import Any, Dict, Optional
|
2017-07-18 00:01:54 -04:00
|
|
|
|
2020-03-26 18:22:46 -04:00
|
|
|
ZULIP_BOTSERVER_VERSION = "0.6.4"
|
2017-09-20 19:02:43 -04:00
|
|
|
|
2017-07-18 00:01:54 -04:00
|
|
|
# We should be installable with either setuptools or distutils.
|
|
|
|
package_info = dict(
|
|
|
|
name='zulip_botserver',
|
2017-09-20 19:02:43 -04:00
|
|
|
version=ZULIP_BOTSERVER_VERSION,
|
2017-07-18 00:01:54 -04:00
|
|
|
description='Zulip\'s Flask server for running bots',
|
|
|
|
author='Zulip Open Source Project',
|
|
|
|
author_email='zulip-devel@googlegroups.com',
|
|
|
|
classifiers=[
|
|
|
|
'Development Status :: 4 - Beta',
|
|
|
|
'Environment :: Web Environment',
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'License :: OSI Approved :: MIT License',
|
|
|
|
'Topic :: Communications :: Chat',
|
2019-07-30 18:35:29 -04:00
|
|
|
'Programming Language :: Python :: 3',
|
|
|
|
'Programming Language :: Python :: 3.5',
|
|
|
|
'Programming Language :: Python :: 3.6',
|
|
|
|
'Programming Language :: Python :: 3.7',
|
2020-03-25 21:54:35 -04:00
|
|
|
'Programming Language :: Python :: 3.8',
|
2017-07-18 00:01:54 -04:00
|
|
|
],
|
2019-07-30 18:35:29 -04:00
|
|
|
python_requires='>=3.5',
|
2017-07-18 00:01:54 -04:00
|
|
|
url='https://www.zulip.org/',
|
|
|
|
entry_points={
|
|
|
|
'console_scripts': [
|
2018-05-31 03:26:11 -04:00
|
|
|
'zulip-botserver=zulip_botserver.server:main',
|
2017-07-18 00:01:54 -04:00
|
|
|
],
|
|
|
|
},
|
|
|
|
test_suite='tests',
|
2019-08-07 20:18:25 -04:00
|
|
|
package_data={'zulip_botserver': ['py.typed']},
|
2017-07-18 00:01:54 -04:00
|
|
|
) # type: Dict[str, Any]
|
|
|
|
|
|
|
|
setuptools_info = dict(
|
|
|
|
install_requires=[
|
2017-09-20 19:02:43 -04:00
|
|
|
'zulip',
|
|
|
|
'zulip_bots',
|
2017-07-18 00:01:54 -04:00
|
|
|
'flask>=0.12.2',
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
try:
|
|
|
|
from setuptools import setup, find_packages
|
|
|
|
package_info.update(setuptools_info)
|
|
|
|
package_info['packages'] = find_packages(exclude=['tests'])
|
|
|
|
|
|
|
|
except ImportError:
|
|
|
|
from distutils.core import setup
|
|
|
|
from distutils.version import LooseVersion
|
|
|
|
from importlib import import_module
|
|
|
|
|
|
|
|
# Manual dependency check
|
|
|
|
def check_dependency_manually(module_name, version=None):
|
2017-10-11 01:55:18 -04:00
|
|
|
# type: (str, Optional[str]) -> None
|
2017-07-18 00:01:54 -04:00
|
|
|
try:
|
2017-10-11 01:55:18 -04:00
|
|
|
module = import_module(module_name) # type: Any
|
2017-07-18 00:01:54 -04:00
|
|
|
if version is not None:
|
|
|
|
assert(LooseVersion(module.__version__) >= LooseVersion(version))
|
|
|
|
except (ImportError, AssertionError):
|
|
|
|
if version is not None:
|
|
|
|
print("{name}>={version} is not installed.".format(
|
2017-10-11 01:55:18 -04:00
|
|
|
name=module_name, version=version), file=sys.stderr)
|
2017-07-18 00:01:54 -04:00
|
|
|
else:
|
|
|
|
print("{name} is not installed.".format(name=module_name), file=sys.stderr)
|
|
|
|
sys.exit(1)
|
|
|
|
|
2017-09-20 19:02:43 -04:00
|
|
|
check_dependency_manually('zulip')
|
|
|
|
check_dependency_manually('zulip_bots')
|
2017-07-18 00:01:54 -04:00
|
|
|
check_dependency_manually('flask', '0.12.2')
|
|
|
|
|
|
|
|
package_info['packages'] = ['zulip_botserver']
|
|
|
|
|
|
|
|
|
|
|
|
setup(**package_info)
|