-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathsetup.py
More file actions
30 lines (23 loc) · 1.08 KB
/
setup.py
File metadata and controls
30 lines (23 loc) · 1.08 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
# Copyright (c) 2018 Radio Astronomy Software Group
# Licensed under the 3-clause BSD License
from setuptools import setup
# The only reason we currently need a setup.py is because we use a special
# branch scheme. See https://setuptools-scm.readthedocs.io/en/stable/customizing/
# define the branch scheme. Have to do it here so we don't have to modify the path
def branch_scheme(version):
"""
Local version scheme that adds the branch name for absolute reproducibility.
If and when this is added to setuptools_scm this function can be removed.
"""
if version.exact or version.node is None:
return version.format_choice("", "+d{time:{time_format}}", time_format="%Y%m%d")
else:
if version.branch == "main":
return version.format_choice("+{node}", "+{node}.dirty")
else:
version_str = version.format_choice(
"+{node}.{branch}", "+{node}.{branch}.dirty"
)
version_str = version_str.replace("/", ".")
return version_str
setup(use_scm_version={"local_scheme": branch_scheme})