|
1 | 1 | import os
|
2 |
| -from setuptools import setup |
| 2 | +import sys |
| 3 | +from setuptools import setup, find_packages |
| 4 | + |
| 5 | +THIS_DIR = os.path.dirname(os.path.realpath(__file__)) |
| 6 | +CONNECTOR_SRC_DIR = os.path.join(THIS_DIR, "polypheny") |
| 7 | + |
| 8 | +VERSION = (1, 1, 1, None) # Default |
| 9 | +VERSION = "v1.1.1" # Default |
| 10 | + |
3 | 11 |
|
4 | 12 | version_file = 'polypheny-connector-version.txt'
|
5 | 13 |
|
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.") |
| 14 | +# necessary for automated build pipeline |
| 15 | +if os.path.exists(version_file): |
| 16 | + with open(version_file, 'r') as f: |
| 17 | + version = f.read().strip() |
| 18 | + |
| 19 | +else: |
| 20 | + version = VERSION |
| 21 | + #raise ValueError(f"Version file '{version_file}' not found. Please create the file with the version number.") |
8 | 22 |
|
9 |
| -with open(version_file, 'r') as f: |
10 |
| - version = f.read().strip() |
11 | 23 |
|
12 |
| -print(f"Building version: {version}") |
| 24 | +#print(f"Building version: {version}") |
13 | 25 |
|
14 | 26 | if not version.startswith('v'):
|
15 | 27 | raise ValueError(f"Invalid version format: {version}. Expected format 'v0.0.0'.")
|
16 | 28 |
|
17 | 29 | # Strip the 'v' prefix for the version
|
18 | 30 | version = version[1:]
|
19 | 31 |
|
20 |
| -with open('README.md', 'r', encoding='utf-8') as f: |
21 |
| - long_description = f.read() |
| 32 | + |
| 33 | +### Parse command line flags |
| 34 | + |
| 35 | +# This list defines the options definitions in a set |
| 36 | +options_def = { |
| 37 | + "--debug", |
| 38 | +} |
| 39 | + |
| 40 | +# Options is the final parsed command line options |
| 41 | +options = {e.lstrip("-"): False for e in options_def} |
| 42 | + |
| 43 | + |
| 44 | +for flag in options_def: |
| 45 | + if flag in sys.argv: |
| 46 | + options[flag.lstrip("-")] = True |
| 47 | + sys.argv.remove(flag) |
| 48 | + |
| 49 | + |
| 50 | +def readme(): |
| 51 | + with open(os.path.join(THIS_DIR, 'README.md'), encoding="utf-8" ) as f: |
| 52 | + return f.read() |
| 53 | + |
22 | 54 |
|
23 | 55 | setup(
|
24 | 56 | name='polypheny',
|
25 | 57 | version=version,
|
26 | 58 | description='Driver for Polypheny',
|
27 |
| - long_description=long_description, |
| 59 | + long_description=readme(), |
28 | 60 | long_description_content_type='text/markdown',
|
29 | 61 | author="The Polypheny Project",
|
30 | 62 |
|
|
35 | 67 | "Issue tracker": "https://github.com/polypheny/Polypheny-DB/labels/A-python"
|
36 | 68 | },
|
37 | 69 | license="Apache License, Version 2.0",
|
38 |
| - packages=['polypheny'], |
| 70 | + packages=find_packages(), |
| 71 | + include_package_data=True, |
| 72 | + command_options={ |
| 73 | + 'build_sphinx': { |
| 74 | + 'version': ('setup.py', version), |
| 75 | + 'release': ('setup.py', version), |
| 76 | + }, |
| 77 | + }, |
| 78 | + python_requires=">=3.8", |
39 | 79 | install_requires=[
|
40 | 80 | "polypheny-prism-api==1.9",
|
41 | 81 | ],
|
|
0 commit comments