forked from ufz/ogs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
72 lines (63 loc) · 2.47 KB
/
setup.py
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
72
from skbuild import setup
from setuptools import find_packages
import os
import platform
import sys
sys.path.append(os.path.join("Applications", "Python"))
from ogs._internal.provide_ogs_cli_tools_via_wheel import binaries_list
console_scripts = []
for b in binaries_list:
console_scripts.append(f"{b}=ogs._internal.provide_ogs_cli_tools_via_wheel:{b}")
from pathlib import Path
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
# setuptools_scm config local_scheme via env var SETUPTOOLS_SCM_LOCAL_SCHEME:
scm_local_scheme = "node-and-date"
if "SETUPTOOLS_SCM_LOCAL_SCHEME" in os.environ:
local_scheme_values = [
"node-and-date",
"node-and-timestamp",
"dirty-tag",
"no-local-version",
]
if os.environ["SETUPTOOLS_SCM_LOCAL_SCHEME"] in local_scheme_values:
scm_local_scheme = os.environ["SETUPTOOLS_SCM_LOCAL_SCHEME"]
if "CMAKE_ARGS" in os.environ:
print(
"WARNING: Default CMake preset 'wheel' overridden! "
"Be sure to pass a proper preset or configuration!"
)
else:
cmake_preset = "wheel"
if platform.system() == "Windows":
cmake_preset += "-win"
os.environ["CMAKE_ARGS"] = f"--preset {cmake_preset}"
cmake_args = ["-B ."]
if "SKBUILD_GENERATOR" in os.environ:
cmake_args.extend(["-G", os.environ["SKBUILD_GENERATOR"]])
setup(
name="ogs",
description="OpenGeoSys Python Module",
long_description=long_description,
long_description_content_type="text/markdown",
author="OpenGeoSys Community",
license="BSD-3-Clause",
packages=find_packages(where="Applications/Python"),
package_dir={"": "Applications/Python"},
cmake_install_dir="Applications/Python/ogs",
extras_require={"test": ["pytest", "numpy"]},
cmake_args=cmake_args,
python_requires=">=3.7",
entry_points={"console_scripts": console_scripts},
use_scm_version={
"write_to": "Applications/Python/_version.py",
"write_to_template": '__version__ = "{version}"',
# Switching to guess-next-dev (default) would increment the version number
# This would be in line with PEP 440, switch OGS versioning too?
"version_scheme": "no-guess-dev",
"local_scheme": scm_local_scheme,
# Was in pyproject.toml but it somehow reset the version scheme. Maybe
# it is better to do all scm config here.
"git_describe_command": 'git describe --dirty --tags --long --match "*[0-9]*" --abbrev=8',
},
)