2016-04-07 15:03:22 +02:00
|
|
|
#!/usr/bin/env python
|
2013-01-31 21:09:59 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2015-11-01 17:11:06 +01:00
|
|
|
from __future__ import print_function
|
2016-07-30 05:26:29 +02:00
|
|
|
if False: from typing import Any, Generator, List, Tuple
|
2016-01-26 02:29:47 +01:00
|
|
|
|
2013-02-22 17:42:53 +01:00
|
|
|
import os
|
2013-10-31 20:48:59 +01:00
|
|
|
import sys
|
|
|
|
|
|
|
|
import itertools
|
|
|
|
|
|
|
|
def version():
|
2016-07-30 05:26:29 +02:00
|
|
|
# type: () -> str
|
2013-10-31 21:22:46 +01:00
|
|
|
version_py = os.path.join(os.path.dirname(__file__), "zulip", "__init__.py")
|
|
|
|
with open(version_py) as in_handle:
|
2015-11-01 17:10:58 +01:00
|
|
|
version_line = next(itertools.dropwhile(lambda x: not x.startswith("__version__"),
|
|
|
|
in_handle))
|
2013-10-31 21:22:46 +01:00
|
|
|
version = version_line.split('=')[-1].strip().replace('"', '')
|
|
|
|
return version
|
2013-01-31 21:09:59 +01:00
|
|
|
|
2013-03-26 22:55:57 +01:00
|
|
|
def recur_expand(target_root, dir):
|
2016-01-26 02:29:47 +01:00
|
|
|
# type: (Any, Any) -> Generator[Tuple[str, List[str]], None, None]
|
2013-10-31 21:22:46 +01:00
|
|
|
for root, _, files in os.walk(dir):
|
|
|
|
paths = [os.path.join(root, f) for f in files]
|
|
|
|
if len(paths):
|
|
|
|
yield os.path.join(target_root, root), paths
|
2013-03-26 22:55:57 +01:00
|
|
|
|
2013-10-31 20:50:23 +01:00
|
|
|
# We should be installable with either setuptools or distutils.
|
|
|
|
package_info = dict(
|
|
|
|
name='zulip',
|
|
|
|
version=version(),
|
|
|
|
description='Bindings for the Zulip message API',
|
2016-12-14 07:05:24 +01:00
|
|
|
author='Zulip Open Source Project',
|
2015-09-29 06:17:08 +02:00
|
|
|
author_email='zulip-devel@googlegroups.com',
|
2013-10-31 20:50:23 +01:00
|
|
|
classifiers=[
|
|
|
|
'Development Status :: 3 - Alpha',
|
|
|
|
'Environment :: Web Environment',
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'License :: OSI Approved :: MIT License',
|
|
|
|
'Topic :: Communications :: Chat',
|
|
|
|
],
|
|
|
|
url='https://www.zulip.com/dist/api/',
|
|
|
|
packages=['zulip'],
|
2016-12-14 07:05:36 +01:00
|
|
|
data_files=[('share/zulip/examples',
|
|
|
|
["examples/zuliprc",
|
|
|
|
"examples/create-user",
|
|
|
|
"examples/edit-message",
|
|
|
|
"examples/get-public-streams",
|
|
|
|
"examples/list-members",
|
|
|
|
"examples/list-subscriptions",
|
|
|
|
"examples/print-events",
|
|
|
|
"examples/print-messages",
|
|
|
|
"examples/recent-messages",
|
|
|
|
"examples/send-message",
|
|
|
|
"examples/subscribe",
|
|
|
|
"examples/unsubscribe",
|
|
|
|
])] + list(recur_expand('share/zulip', 'integrations/')),
|
2013-10-31 20:50:23 +01:00
|
|
|
scripts=["bin/zulip-send"],
|
2016-07-30 05:26:29 +02:00
|
|
|
) # type: Dict[str, Any]
|
2013-10-31 20:50:23 +01:00
|
|
|
|
|
|
|
setuptools_info = dict(
|
|
|
|
install_requires=['requests>=0.12.1',
|
|
|
|
'simplejson',
|
2016-01-24 03:39:35 +01:00
|
|
|
'six',
|
2016-12-14 07:05:47 +01:00
|
|
|
'typing>=3.5.2.2',
|
2013-10-31 20:50:23 +01:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
try:
|
2013-10-31 21:22:46 +01:00
|
|
|
from setuptools import setup
|
|
|
|
package_info.update(setuptools_info)
|
2013-10-31 20:50:23 +01:00
|
|
|
except ImportError:
|
2013-10-31 21:22:46 +01:00
|
|
|
from distutils.core import setup
|
|
|
|
from distutils.version import LooseVersion
|
|
|
|
# Manual dependency check
|
|
|
|
try:
|
|
|
|
import simplejson
|
|
|
|
except ImportError:
|
2015-11-01 17:11:06 +01:00
|
|
|
print("simplejson is not installed", file=sys.stderr)
|
2013-10-31 21:22:46 +01:00
|
|
|
sys.exit(1)
|
|
|
|
try:
|
|
|
|
import requests
|
2016-10-17 08:22:00 +02:00
|
|
|
assert(LooseVersion(requests.__version__) >= LooseVersion('0.12.1'))
|
2013-10-31 21:22:46 +01:00
|
|
|
except (ImportError, AssertionError):
|
2015-11-01 17:11:06 +01:00
|
|
|
print("requests >=0.12.1 is not installed", file=sys.stderr)
|
2013-10-31 21:22:46 +01:00
|
|
|
sys.exit(1)
|
2013-10-31 20:50:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
setup(**package_info)
|