Optionally use setuptools if it is installed.
Thanks to to github.com/roryk for the suggestion. (imported from commit 9e4365dc56f1bc2f1a1a49be4a7b662d94bf42a9)
This commit is contained in:
parent
0923b7d3ef
commit
b0f73806de
73
setup.py
73
setup.py
|
@ -4,7 +4,6 @@
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from distutils.core import setup
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
|
@ -23,24 +22,54 @@ def recur_expand(target_root, dir):
|
||||||
if len(paths):
|
if len(paths):
|
||||||
yield os.path.join(target_root, root), paths
|
yield os.path.join(target_root, root), paths
|
||||||
|
|
||||||
setup(name='zulip',
|
# We should be installable with either setuptools or distutils.
|
||||||
version=version(),
|
package_info = dict(
|
||||||
description='Bindings for the Zulip message API',
|
name='zulip',
|
||||||
author='Zulip, Inc.',
|
version=version(),
|
||||||
author_email='zulip@zulip.com',
|
description='Bindings for the Zulip message API',
|
||||||
classifiers=[
|
author='Zulip, Inc.',
|
||||||
'Development Status :: 3 - Alpha',
|
author_email='humbug@humbughq.com',
|
||||||
'Environment :: Web Environment',
|
classifiers=[
|
||||||
'Intended Audience :: Developers',
|
'Development Status :: 3 - Alpha',
|
||||||
'License :: OSI Approved :: MIT License',
|
'Environment :: Web Environment',
|
||||||
'Topic :: Communications :: Chat',
|
'Intended Audience :: Developers',
|
||||||
],
|
'License :: OSI Approved :: MIT License',
|
||||||
url='https://www.zulip.com/dist/api/',
|
'Topic :: Communications :: Chat',
|
||||||
packages=['zulip'],
|
],
|
||||||
data_files=[('share/zulip/examples', ["examples/zuliprc", "examples/send-message", "examples/subscribe",
|
url='https://www.zulip.com/dist/api/',
|
||||||
"examples/get-public-streams", "examples/unsubscribe",
|
packages=['zulip'],
|
||||||
"examples/list-members", "examples/list-subscriptions",
|
data_files=[('share/zulip/examples', ["examples/zuliprc", "examples/send-message", "examples/subscribe",
|
||||||
"examples/print-messages"])] + \
|
"examples/get-public-streams", "examples/unsubscribe",
|
||||||
list(recur_expand('share/zulip', 'integrations/')),
|
"examples/list-members", "examples/list-subscriptions",
|
||||||
scripts=["bin/zulip-send"],
|
"examples/print-messages"])] + \
|
||||||
)
|
list(recur_expand('share/zulip', 'integrations/')),
|
||||||
|
scripts=["bin/zulip-send"],
|
||||||
|
)
|
||||||
|
|
||||||
|
setuptools_info = dict(
|
||||||
|
install_requires=['requests>=0.12.1',
|
||||||
|
'simplejson',
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from setuptools import setup
|
||||||
|
package_info.update(setuptools_info)
|
||||||
|
except ImportError:
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
setup(**package_info)
|
||||||
|
|
Loading…
Reference in a new issue