Parse __version__ from __init__.py
This way we don't crash if dependencies aren't installed. License assent: https://github.com/zulip/python-zulip/pull/3#issuecomment-18182458 (imported from commit f1aa37e97c60a06234c004ada48e08984a085d6f)
This commit is contained in:
parent
4a0758e058
commit
0923b7d3ef
13
setup.py
13
setup.py
|
@ -5,6 +5,17 @@ import zulip
|
|||
|
||||
import os
|
||||
from distutils.core import setup
|
||||
import sys
|
||||
|
||||
import itertools
|
||||
|
||||
def version():
|
||||
version_py = os.path.join(os.path.dirname(__file__), "zulip", "__init__.py")
|
||||
with open(version_py) as in_handle:
|
||||
version_line = itertools.dropwhile(lambda x: not x.startswith("__version__"),
|
||||
in_handle).next()
|
||||
version = version_line.split('=')[-1].strip().replace('"', '')
|
||||
return version
|
||||
|
||||
def recur_expand(target_root, dir):
|
||||
for root, _, files in os.walk(dir):
|
||||
|
@ -13,7 +24,7 @@ def recur_expand(target_root, dir):
|
|||
yield os.path.join(target_root, root), paths
|
||||
|
||||
setup(name='zulip',
|
||||
version=zulip.__version__,
|
||||
version=version(),
|
||||
description='Bindings for the Zulip message API',
|
||||
author='Zulip, Inc.',
|
||||
author_email='zulip@zulip.com',
|
||||
|
|
Loading…
Reference in a new issue