2020-04-03 05:11:02 -04:00
|
|
|
#!/usr/bin/env python3
|
2017-07-18 00:01:54 -04:00
|
|
|
|
|
|
|
import sys
|
2020-04-18 18:49:45 -04:00
|
|
|
from typing import Any, Dict, Optional
|
2017-07-18 00:01:54 -04:00
|
|
|
|
2021-10-19 17:53:14 -04:00
|
|
|
ZULIP_BOTSERVER_VERSION = "0.8.1"
|
2017-09-20 19:02:43 -04:00
|
|
|
|
2020-04-09 20:14:01 -04:00
|
|
|
with open("README.md") as fh:
|
2020-04-16 20:34:03 -04:00
|
|
|
long_description = fh.read()
|
|
|
|
|
2017-07-18 00:01:54 -04:00
|
|
|
# We should be installable with either setuptools or distutils.
|
|
|
|
package_info = dict(
|
2021-05-28 05:05:11 -04:00
|
|
|
name="zulip_botserver",
|
2017-09-20 19:02:43 -04:00
|
|
|
version=ZULIP_BOTSERVER_VERSION,
|
2021-05-28 05:05:11 -04:00
|
|
|
description="Zulip's Flask server for running bots",
|
2020-04-16 20:34:03 -04:00
|
|
|
long_description=long_description,
|
|
|
|
long_description_content_type="text/markdown",
|
2021-05-28 05:05:11 -04:00
|
|
|
author="Zulip Open Source Project",
|
|
|
|
author_email="zulip-devel@googlegroups.com",
|
2017-07-18 00:01:54 -04:00
|
|
|
classifiers=[
|
2021-05-28 05:05:11 -04:00
|
|
|
"Development Status :: 4 - Beta",
|
|
|
|
"Environment :: Web Environment",
|
|
|
|
"Intended Audience :: Developers",
|
|
|
|
"License :: OSI Approved :: Apache Software License",
|
|
|
|
"Topic :: Communications :: Chat",
|
|
|
|
"Programming Language :: Python :: 3",
|
|
|
|
"Programming Language :: Python :: 3.6",
|
|
|
|
"Programming Language :: Python :: 3.7",
|
|
|
|
"Programming Language :: Python :: 3.8",
|
|
|
|
"Programming Language :: Python :: 3.9",
|
2017-07-18 00:01:54 -04:00
|
|
|
],
|
2021-05-28 05:05:11 -04:00
|
|
|
python_requires=">=3.6",
|
|
|
|
url="https://www.zulip.org/",
|
2020-05-02 18:31:39 -04:00
|
|
|
project_urls={
|
|
|
|
"Source": "https://github.com/zulip/python-zulip-api/",
|
2020-06-08 17:03:27 -04:00
|
|
|
"Documentation": "https://zulip.com/api",
|
2020-05-02 18:31:39 -04:00
|
|
|
},
|
2017-07-18 00:01:54 -04:00
|
|
|
entry_points={
|
2021-05-28 05:05:11 -04:00
|
|
|
"console_scripts": [
|
|
|
|
"zulip-botserver=zulip_botserver.server:main",
|
2017-07-18 00:01:54 -04:00
|
|
|
],
|
|
|
|
},
|
2021-05-28 05:05:11 -04:00
|
|
|
test_suite="tests",
|
|
|
|
package_data={"zulip_botserver": ["py.typed"]},
|
2017-07-18 00:01:54 -04:00
|
|
|
) # type: Dict[str, Any]
|
|
|
|
|
|
|
|
setuptools_info = dict(
|
|
|
|
install_requires=[
|
2021-05-28 05:05:11 -04:00
|
|
|
"zulip",
|
|
|
|
"zulip_bots",
|
|
|
|
"flask>=0.12.2",
|
2017-07-18 00:01:54 -04:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
try:
|
2021-05-28 05:00:04 -04:00
|
|
|
from setuptools import find_packages, setup
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2017-07-18 00:01:54 -04:00
|
|
|
package_info.update(setuptools_info)
|
2021-05-28 05:05:11 -04:00
|
|
|
package_info["packages"] = find_packages(exclude=["tests"])
|
2017-07-18 00:01:54 -04:00
|
|
|
|
|
|
|
except ImportError:
|
|
|
|
from distutils.core import setup
|
|
|
|
from distutils.version import LooseVersion
|
|
|
|
from importlib import import_module
|
|
|
|
|
|
|
|
# Manual dependency check
|
2020-04-18 18:59:12 -04:00
|
|
|
def check_dependency_manually(module_name: str, version: Optional[str] = None) -> 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:
|
2021-05-28 05:03:46 -04:00
|
|
|
assert LooseVersion(module.__version__) >= LooseVersion(version)
|
2017-07-18 00:01:54 -04:00
|
|
|
except (ImportError, AssertionError):
|
|
|
|
if version is not None:
|
2021-05-28 05:03:46 -04:00
|
|
|
print(
|
2021-05-28 07:19:40 -04:00
|
|
|
f"{module_name}>={version} is not installed.",
|
2021-05-28 05:03:46 -04:00
|
|
|
file=sys.stderr,
|
|
|
|
)
|
2017-07-18 00:01:54 -04:00
|
|
|
else:
|
2021-05-28 07:19:40 -04:00
|
|
|
print(f"{module_name} is not installed.", file=sys.stderr)
|
2017-07-18 00:01:54 -04:00
|
|
|
sys.exit(1)
|
|
|
|
|
2021-05-28 05:05:11 -04:00
|
|
|
check_dependency_manually("zulip")
|
|
|
|
check_dependency_manually("zulip_bots")
|
|
|
|
check_dependency_manually("flask", "0.12.2")
|
2017-07-18 00:01:54 -04:00
|
|
|
|
2021-05-28 05:05:11 -04:00
|
|
|
package_info["packages"] = ["zulip_botserver"]
|
2017-07-18 00:01:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
setup(**package_info)
|