2016-04-07 18:33:22 +05:30
|
|
|
#!/usr/bin/env python
|
2013-01-31 15:09:59 -05:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2015-11-01 08:11:06 -08:00
|
|
|
from __future__ import print_function
|
2016-12-27 20:16:12 -08:00
|
|
|
if False:
|
2017-03-03 23:31:52 +05:30
|
|
|
from typing import Any, Dict, Generator, List, Tuple
|
2016-01-25 17:29:47 -08:00
|
|
|
|
2013-02-22 11:42:53 -05:00
|
|
|
import os
|
2013-10-31 15:48:59 -04:00
|
|
|
import sys
|
|
|
|
|
|
|
|
import itertools
|
|
|
|
|
|
|
|
def version():
|
2016-07-29 20:26:29 -07:00
|
|
|
# type: () -> str
|
2013-10-31 16:22:46 -04:00
|
|
|
version_py = os.path.join(os.path.dirname(__file__), "zulip", "__init__.py")
|
|
|
|
with open(version_py) as in_handle:
|
2015-11-01 08:10:58 -08:00
|
|
|
version_line = next(itertools.dropwhile(lambda x: not x.startswith("__version__"),
|
2016-12-27 20:16:12 -08:00
|
|
|
in_handle))
|
2013-10-31 16:22:46 -04:00
|
|
|
version = version_line.split('=')[-1].strip().replace('"', '')
|
|
|
|
return version
|
2013-01-31 15:09:59 -05:00
|
|
|
|
2013-03-26 17:55:57 -04:00
|
|
|
def recur_expand(target_root, dir):
|
2016-01-25 17:29:47 -08:00
|
|
|
# type: (Any, Any) -> Generator[Tuple[str, List[str]], None, None]
|
2013-10-31 16:22:46 -04: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 17:55:57 -04:00
|
|
|
|
2013-10-31 15:50:23 -04: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-13 22:05:24 -08:00
|
|
|
author='Zulip Open Source Project',
|
2015-09-28 21:17:08 -07:00
|
|
|
author_email='zulip-devel@googlegroups.com',
|
2013-10-31 15:50:23 -04:00
|
|
|
classifiers=[
|
2017-05-31 02:32:11 -02:30
|
|
|
'Development Status :: 4 - Beta',
|
2013-10-31 15:50:23 -04:00
|
|
|
'Environment :: Web Environment',
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'License :: OSI Approved :: MIT License',
|
|
|
|
'Topic :: Communications :: Chat',
|
|
|
|
],
|
2017-05-31 02:32:11 -02:30
|
|
|
url='https://www.zulip.org/',
|
2017-09-13 11:39:15 +02:00
|
|
|
data_files=list(recur_expand('share/zulip', 'integrations')),
|
|
|
|
include_package_data=True,
|
2017-05-21 19:54:16 -02:30
|
|
|
entry_points={
|
|
|
|
'console_scripts': [
|
|
|
|
'zulip-send=zulip.send:main',
|
2017-08-25 18:02:53 +02:00
|
|
|
'zulip-api-examples=zulip.api_examples:main'
|
2017-05-21 19:54:16 -02:30
|
|
|
],
|
|
|
|
},
|
2018-04-23 16:33:53 -07:00
|
|
|
package_data={'zulip': ["py.typed"]},
|
2017-05-07 20:08:34 +05:30
|
|
|
) # type: Dict[str, Any]
|
2013-10-31 15:50:23 -04:00
|
|
|
|
|
|
|
setuptools_info = dict(
|
|
|
|
install_requires=['requests>=0.12.1',
|
2016-01-23 18:39:35 -08:00
|
|
|
'six',
|
2016-12-13 22:05:47 -08:00
|
|
|
'typing>=3.5.2.2',
|
2016-12-27 20:16:12 -08:00
|
|
|
],
|
2013-10-31 15:50:23 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
try:
|
2017-06-14 00:09:36 +05:30
|
|
|
from setuptools import setup, find_packages
|
2013-10-31 16:22:46 -04:00
|
|
|
package_info.update(setuptools_info)
|
2017-09-04 20:19:39 +02:00
|
|
|
package_info['packages'] = find_packages(exclude=['tests'])
|
2017-06-14 00:09:36 +05:30
|
|
|
|
2013-10-31 15:50:23 -04:00
|
|
|
except ImportError:
|
2013-10-31 16:22:46 -04:00
|
|
|
from distutils.core import setup
|
|
|
|
from distutils.version import LooseVersion
|
|
|
|
# Manual dependency check
|
|
|
|
try:
|
|
|
|
import requests
|
2016-10-16 23:22:00 -07:00
|
|
|
assert(LooseVersion(requests.__version__) >= LooseVersion('0.12.1'))
|
2013-10-31 16:22:46 -04:00
|
|
|
except (ImportError, AssertionError):
|
2015-11-01 08:11:06 -08:00
|
|
|
print("requests >=0.12.1 is not installed", file=sys.stderr)
|
2013-10-31 16:22:46 -04:00
|
|
|
sys.exit(1)
|
2013-10-31 15:50:23 -04:00
|
|
|
|
2017-07-18 01:49:51 -02:30
|
|
|
package_info['packages'] = ['zulip']
|
2017-06-14 00:09:36 +05:30
|
|
|
|
2013-10-31 15:50:23 -04:00
|
|
|
|
|
|
|
setup(**package_info)
|