forked from astropy/astropy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion.py
More file actions
41 lines (29 loc) · 984 Bytes
/
version.py
File metadata and controls
41 lines (29 loc) · 984 Bytes
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
# NOTE: First try _dev.scm_version if it exists and setuptools_scm is installed
# This file is not included in astropy wheels/tarballs, so otherwise it will
# fall back on the generated _version module.
try:
try:
from ._dev.scm_version import version
except ImportError:
from ._version import version
except Exception:
import warnings
warnings.warn(
f'could not determine {__name__.split(".")[0]} package version; '
"this indicates a broken installation"
)
del warnings
version = "0.0.0"
# We use Version to define major, minor, micro, but ignore any suffixes.
def split_version(version):
pieces = [0, 0, 0]
try:
from packaging.version import Version
v = Version(version)
pieces = [v.major, v.minor, v.micro]
except Exception:
pass
return pieces
major, minor, bugfix = split_version(version)
del split_version # clean up namespace.
release = "dev" not in version