-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
71 lines (63 loc) · 2.14 KB
/
setup.py
File metadata and controls
71 lines (63 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import os
import sys
from setuptools import setup, find_packages
THIS_DIR = os.path.dirname(os.path.realpath(__file__))
# Default fallback version
DEFAULT_VERSION = "v0.0.0"
VERSION_FILE = os.path.join(THIS_DIR, 'polyNOM-version.txt')
# Read version from file or fallback
if os.path.exists(VERSION_FILE):
with open(VERSION_FILE, 'r') as f:
version_raw = f.read().strip()
else:
version_raw = DEFAULT_VERSION
# Validate and normalize version
if not version_raw.startswith('v'):
raise ValueError(f"Invalid version format: {version_raw}. Expected format 'v0.0.0'.")
version = version_raw[1:] # strip 'v'
# Optional debug flag parsing
options_def = {"--debug"}
options = {flag.lstrip("-"): False for flag in options_def}
for flag in options_def:
if flag in sys.argv:
options[flag.lstrip("-")] = True
sys.argv.remove(flag)
# Read README.md as long description
def readme():
with open(os.path.join(THIS_DIR, 'README.md'), encoding="utf-8") as f:
return f.read()
def load_requirements(filename='requirements.txt', exclude=None):
exclude = exclude or []
with open(os.path.join(THIS_DIR, filename)) as f:
return [
line.strip() for line in f
if line.strip() and not line.startswith('#') and line.strip() not in exclude
]
setup(
name='polypheny-polynom',
version=version,
description='Object Mapper for Polypheny',
long_description=readme(),
long_description_content_type='text/markdown',
author="The Polypheny Project",
author_email="mail@polypheny.org",
url="https://polypheny.com/",
project_urls={
"Documentation": "https://github.com/polypheny/PolyNOM/docs",
"Code": "https://github.com/polypheny/PolyNOM",
},
license="Apache License, Version 2.0",
packages=find_packages(include=["polynom*"]),
include_package_data=True,
command_options={
'build_sphinx': {
'version': ('setup.py', version),
'release': ('setup.py', version),
},
},
python_requires=">=3.11",
install_requires=load_requirements(exclude=['pytest']),
extras_require={
"dev": ["pytest"],
},
)