2015-10-04 12:56:26 -04:00
|
|
|
#!/usr/bin/env python2.7
|
2013-01-31 15:09:59 -05:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2013-02-22 11:42:53 -05:00
|
|
|
import os
|
2013-10-31 15:48:59 -04:00
|
|
|
import sys
|
|
|
|
|
|
|
|
import itertools
|
|
|
|
|
|
|
|
def version():
|
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 11:10:58 -05:00
|
|
|
version_line = next(itertools.dropwhile(lambda x: not x.startswith("__version__"),
|
|
|
|
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):
|
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',
|
|
|
|
author='Zulip, Inc.',
|
2015-09-29 00:17:08 -04:00
|
|
|
author_email='zulip-devel@googlegroups.com',
|
2013-10-31 15:50:23 -04: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'],
|
|
|
|
data_files=[('share/zulip/examples', ["examples/zuliprc", "examples/send-message", "examples/subscribe",
|
|
|
|
"examples/get-public-streams", "examples/unsubscribe",
|
|
|
|
"examples/list-members", "examples/list-subscriptions",
|
|
|
|
"examples/print-messages"])] + \
|
|
|
|
list(recur_expand('share/zulip', 'integrations/')),
|
|
|
|
scripts=["bin/zulip-send"],
|
|
|
|
)
|
|
|
|
|
|
|
|
setuptools_info = dict(
|
|
|
|
install_requires=['requests>=0.12.1',
|
|
|
|
'simplejson',
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
try:
|
2013-10-31 16:22:46 -04:00
|
|
|
from setuptools import setup
|
|
|
|
package_info.update(setuptools_info)
|
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 simplejson
|
|
|
|
except ImportError:
|
|
|
|
print >>sys.stderr, "simplejson is not installed"
|
|
|
|
sys.exit(1)
|
|
|
|
try:
|
|
|
|
import requests
|
|
|
|
assert(LooseVersion(requests.__version__) >= LooseVersion('0.12.1'))
|
|
|
|
except (ImportError, AssertionError):
|
|
|
|
print >>sys.stderr, "requests >=0.12.1 is not installed"
|
|
|
|
sys.exit(1)
|
2013-10-31 15:50:23 -04:00
|
|
|
|
|
|
|
|
|
|
|
setup(**package_info)
|