Coverage for /usr/local/lib/python3.11/dist-packages/grond/info.py: 77%
43 statements
« prev ^ index » next coverage.py v6.5.0, created at 2023-10-26 16:25 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2023-10-26 16:25 +0000
1from pyrocko.guts import Object, String, Dict, Bool
3from grond.setup_info import git_sha1, local_modifications, \
4 version, long_version, installed_date
6guts_prefix = 'grond'
9class VersionInfo(Object):
10 grond_version = String.T(yamlstyle="'")
11 grond_long_version = String.T(yamlstyle="'")
12 git_sha1 = String.T(optional=True, yamlstyle="'")
13 local_modifications = Bool.T(optional=True)
14 installed_date = String.T(optional=True, yamlstyle="'")
15 dependencies = Dict.T(String.T(), String.T(yamlstyle="'"))
18def version_info():
20 deps = {}
22 try:
23 import pyrocko
24 deps['pyrocko'] = pyrocko.long_version
25 except ImportError:
26 pass
28 try:
29 import numpy
30 deps['numpy'] = numpy.__version__
31 except ImportError:
32 pass
34 try:
35 import scipy
36 deps['scipy'] = scipy.__version__
37 except ImportError:
38 pass
40 try:
41 import matplotlib
42 deps['matplotlib'] = matplotlib.__version__
43 except ImportError:
44 pass
46 try:
47 from pyrocko.gui.qt_compat import Qt
48 deps['PyQt'] = Qt.PYQT_VERSION_STR
49 deps['Qt'] = Qt.QT_VERSION_STR
50 except ImportError:
51 pass
53 import sys
54 deps['python'] = '%s.%s.%s' % sys.version_info[:3]
56 vi = VersionInfo(
57 grond_version=version,
58 grond_long_version=long_version,
59 git_sha1=git_sha1,
60 local_modifications=local_modifications,
61 installed_date=installed_date,
62 dependencies=deps)
64 return vi
67__all__ = ['VersionInfo']