|
1 | 1 | import os
|
2 |
| -import sys |
3 |
| - |
4 | 2 | from setuptools import setup
|
5 | 3 |
|
6 |
| -# Retrieve 'VERSION' environment variable, default to '0.0' if not found. |
7 |
| -version = os.getenv('VERSION', '0.0') |
| 4 | +version_file = 'prism-api-version.txt' |
| 5 | + |
| 6 | +if not os.path.exists(version_file): |
| 7 | + raise ValueError(f"Version file '{version_file}' not found. Please create the file with the version number.") |
| 8 | + |
| 9 | +with open(version_file, 'r') as f: |
| 10 | + version = f.read().strip() |
8 | 11 |
|
9 | 12 | print(f"Building version: {version}")
|
10 | 13 |
|
11 | 14 | if version == '0.0':
|
12 |
| - raise ValueError("Version not set or defaulting to '0.0'. Please set the VERSION environment variable.") |
| 15 | + raise ValueError("Version is set to '0.0'. Please set a valid version number in the version file.") |
13 | 16 |
|
14 | 17 | # Attempt to split the version number, default to '0' for both if it fails
|
15 | 18 | try:
|
16 | 19 | major, minor = version.split('.')
|
17 | 20 | except ValueError:
|
18 | 21 | raise ValueError(f"Invalid version format: {version}. Expected 'major.minor' format.")
|
19 | 22 |
|
20 |
| - |
21 | 23 | with open('org/polypheny/prism/version.py', 'w') as f:
|
22 | 24 | f.write(f'MAJOR_VERSION = {major}\n')
|
23 | 25 | f.write(f'MINOR_VERSION = {minor}\n')
|
24 | 26 |
|
25 |
| - |
26 | 27 | with open('README.md', 'r', encoding='utf-8') as f:
|
27 | 28 | long_description = f.read()
|
28 | 29 |
|
29 |
| -setup(name='polypheny-prism-api', |
30 |
| - version=version, |
31 |
| - description='Polypheny Prism API files for Python', |
32 |
| - long_description=long_description, |
33 |
| - long_description_content_type='text/markdown', |
34 |
| - author="The Polypheny Project", |
35 |
| - |
36 |
| - url="https://polypheny.com/", |
37 |
| - project_urls={ |
| 30 | +setup( |
| 31 | + name='polypheny-prism-api', |
| 32 | + version=version, |
| 33 | + description='Polypheny Prism API files for Python', |
| 34 | + long_description=long_description, |
| 35 | + long_description_content_type='text/markdown', |
| 36 | + author="The Polypheny Project", |
| 37 | + |
| 38 | + url="https://polypheny.com/", |
| 39 | + project_urls={ |
38 | 40 | "Documentation": "https://docs.polypheny.com/en/latest/query_interfaces/prism/protocol",
|
39 | 41 | "Code": "https://github.com/polypheny/Polypheny-Prism-API"
|
40 |
| - }, |
41 |
| - license="Apache License, Version 2.0", |
42 |
| - packages=['org/polypheny/prism'], |
43 |
| - install_requires=[ |
44 |
| - "protobuf==4.24.3", |
45 |
| - ], |
| 42 | + }, |
| 43 | + license="Apache License, Version 2.0", |
| 44 | + packages=['org/polypheny/prism'], |
| 45 | + install_requires=[ |
| 46 | + "protobuf==4.24.3", |
| 47 | + ], |
46 | 48 | )
|
0 commit comments