|
4 | 4 | """ |
5 | 5 |
|
6 | 6 | import os |
| 7 | +import re |
| 8 | + |
| 9 | + |
| 10 | +def get_version(): |
| 11 | + version_file = os.path.join("aleph_message", "__init__.py") |
| 12 | + initfile_lines = open(version_file, "rt").readlines() |
| 13 | + version = r"^__version__ = ['\"]([^'\"]*)['\"]" |
| 14 | + |
| 15 | + for line in initfile_lines: |
| 16 | + mo = re.search(version, line, re.M) |
| 17 | + if mo: |
| 18 | + return mo.group(1) |
| 19 | + raise RuntimeError(f"Unable to find version string in {version_file}.") |
| 20 | + |
7 | 21 |
|
8 | 22 | from setuptools import setup |
9 | 23 |
|
10 | 24 | # allow setup.py to be run from any path |
11 | 25 | os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) |
12 | 26 |
|
13 | | -with open('README.md') as file: |
| 27 | +with open("README.md") as file: |
14 | 28 | long_description = file.read() |
15 | 29 |
|
16 | | -setup(name='aleph-message', |
17 | | - version='0.4.0', |
18 | | - description='Aleph.im message specification ', |
19 | | - long_description=long_description, |
20 | | - long_description_content_type='text/markdown', |
21 | | - author='Hugo Herter', |
22 | | - |
23 | | - url='https://github.com/aleph-im/aleph-message', |
24 | | - packages=['aleph_message', 'aleph_message.models', 'aleph_message.models.execution'], |
25 | | - package_data={"aleph_message": ["py.typed"], |
26 | | - "aleph_message.models": ["py.typed"], |
27 | | - "aleph_message.models.execution": ["py.typed"]}, |
28 | | - data_files=[], |
29 | | - install_requires=[ |
30 | | - 'pydantic~=1.10.5', |
31 | | - 'typing_extensions~=4.5.0', |
32 | | - ], |
33 | | - license='MIT', |
34 | | - platform='any', |
35 | | - keywords="aleph.im message validation specification", |
36 | | - classifiers=['Development Status :: 5 - Production/Stable', |
37 | | - 'Programming Language :: Python :: 3', |
38 | | - 'Intended Audience :: Developers', |
39 | | - 'Topic :: System :: Distributed Computing', |
40 | | - ], |
41 | | - ) |
| 30 | +setup( |
| 31 | + name="aleph-message", |
| 32 | + version=get_version(), |
| 33 | + description="Aleph.im message specification ", |
| 34 | + long_description=long_description, |
| 35 | + long_description_content_type="text/markdown", |
| 36 | + author="Hugo Herter", |
| 37 | + |
| 38 | + url="https://github.com/aleph-im/aleph-message", |
| 39 | + packages=[ |
| 40 | + "aleph_message", |
| 41 | + "aleph_message.models", |
| 42 | + "aleph_message.models.execution", |
| 43 | + ], |
| 44 | + package_data={ |
| 45 | + "aleph_message": ["py.typed"], |
| 46 | + "aleph_message.models": ["py.typed"], |
| 47 | + "aleph_message.models.execution": ["py.typed"], |
| 48 | + }, |
| 49 | + data_files=[], |
| 50 | + install_requires=[ |
| 51 | + "pydantic~=1.10.5", |
| 52 | + "typing_extensions~=4.5.0", |
| 53 | + ], |
| 54 | + license="MIT", |
| 55 | + platform="any", |
| 56 | + keywords="aleph.im message validation specification", |
| 57 | + classifiers=[ |
| 58 | + "Development Status :: 5 - Production/Stable", |
| 59 | + "Programming Language :: Python :: 3", |
| 60 | + "Intended Audience :: Developers", |
| 61 | + "Topic :: System :: Distributed Computing", |
| 62 | + ], |
| 63 | +) |
0 commit comments