|
12 | 12 |
|
13 | 13 | # standard libs |
14 | 14 | import os |
| 15 | +import re |
15 | 16 | from setuptools import setup, find_packages |
16 | 17 |
|
17 | | -# internal libs |
18 | | -from streamkit.__meta__ import (__pkgname__, |
19 | | - __version__, |
20 | | - __authors__, |
21 | | - __contact__, |
22 | | - __license__, |
23 | | - __website__, |
24 | | - __description__) |
25 | | - |
26 | 18 |
|
| 19 | +# get long description from README.rst |
27 | 20 | with open('README.rst', mode='r') as readme: |
28 | 21 | long_description = readme.read() |
29 | 22 |
|
30 | 23 |
|
| 24 | +# get package metadata by parsing __meta__ module |
| 25 | +with open('streamkit/__meta__.py', mode='r') as source: |
| 26 | + content = source.read().strip() |
| 27 | + metadata = {key: re.search(key + r'\s*=\s*[\'"]([^\'"]*)[\'"]', content).group(1) |
| 28 | + for key in ['__pkgname__', '__version__', '__authors__', '__contact__', |
| 29 | + '__description__', '__license__', '__website__']} |
| 30 | + |
| 31 | + |
31 | 32 | # core dependencies |
32 | | -DEPENDENCIES = ['cmdkit>=2.0.2', 'toml>=0.10.1', |
33 | | - 'sqlalchemy>=1.3.19', ] |
| 33 | +DEPENDENCIES = ['cmdkit>=2.0.2', 'toml>=0.10.1', 'sqlalchemy>=1.3.19', ] |
| 34 | + |
34 | 35 |
|
35 | 36 | # add dependencies for readthedocs.io |
36 | 37 | if os.environ.get('READTHEDOCS') == 'True': |
37 | 38 | DEPENDENCIES.extend(['pydata-sphinx-theme']) |
38 | 39 |
|
39 | 40 |
|
40 | 41 | setup( |
41 | | - name = __pkgname__, |
42 | | - version = __version__, |
43 | | - author = __authors__, |
44 | | - author_email = __contact__, |
45 | | - description = __description__, |
46 | | - license = __license__, |
| 42 | + name = metadata['__pkgname__'], |
| 43 | + version = metadata['__version__'], |
| 44 | + author = metadata['__authors__'], |
| 45 | + author_email = metadata['__contact__'], |
| 46 | + description = metadata['__description__'], |
| 47 | + license = metadata['__license__'], |
47 | 48 | keywords = 'pub-sub message broker', |
48 | | - url = __website__, |
| 49 | + url = metadata['__website__'], |
49 | 50 | packages = find_packages(), |
50 | 51 | long_description = long_description, |
51 | 52 | long_description_content_type = 'text/x-rst', |
|
0 commit comments