-
Notifications
You must be signed in to change notification settings - Fork 1
/
installation.py
40 lines (32 loc) · 982 Bytes
/
installation.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
#!/usr/bin/env python3
"""
.. module:: installation
:synopsis: a module for returning installation paths and version numbers.
.. moduleauthor:: Wolfgang Waltenberger <wolfgang.waltenberger@gmail.com>
"""
from typing import Union, Tuple
def version( return_tuple : bool = False) -> Union[str,Tuple]:
"""
Return version number of the protomodels code
:param return_tuple: Return a tuple of (major,minor,patch,...) instead of string
:returns: version, either as string or as tuple
"""
f = open("version" )
l = f.readline()
f.close()
l = l.replace("\n", "")
l.strip()
if not return_tuple:
return l
import re
ret = re.split("\.|-",l)
for i,r in enumerate(ret):
try:
ret[i]=int(r)
except ValueError as e:
pass
return tuple(ret)
def smodels_version( **args ):
""" Return SModelS version """
from smodels.installation import version
return version ( **args )