-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
60 lines (51 loc) · 2.07 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
"""
Setup file for nimue.
Use setup.cfg to configure your project.
This file was generated with PyScaffold 4.5.
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: https://pyscaffold.org/
"""
from setuptools import setup
from setuptools_scm.version import SEMVER_MINOR, guess_next_simple_semver, release_branch_semver_version
def custom_version():
"""
Custom version scheme for setuptools_scm.
This function defines a custom version scheme that:
- Uses `release_branch_semver_version` to determine the version for release branches.
- Falls back to the guessed next simple semantic version if the release branch version is not different.
- Formats the version according to the semantic versioning minor scheme.
"""
def my_release_branch_semver_version(version):
"""
Determine the version for a release branch.
If the release branch version is the same as the guessed next version, format the version
using a custom format.
Args:
version (setuptools_scm.version.ScmVersion): The current version object.
Returns:
str: The formatted version string.
"""
v = release_branch_semver_version(version)
# Check if the release branch version is the same as the guessed next simple semver
if v == version.format_next_version(guess_next_simple_semver, retain=SEMVER_MINOR):
# Return the formatted guessed next version
return version.format_next_version(guess_next_simple_semver, fmt="{guessed}", retain=SEMVER_MINOR)
return v
return {
'version_scheme': my_release_branch_semver_version,
'local_scheme': 'no-local-version',
}
if __name__ == "__main__":
try:
setup(
name="nimue-rt",
use_scm_version=custom_version
)
except: # noqa
print(
"\n\nAn error occurred while building the project, "
"please ensure you have the most updated version of setuptools, "
"setuptools_scm and wheel with:\n"
" pip install -U setuptools setuptools_scm wheel\n\n"
)
raise