Coverage for /usr/local/lib/python3.11/dist-packages/pyrocko/print_version.py: 0%
37 statements
« prev ^ index » next coverage.py v6.5.0, created at 2023-10-04 09:52 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2023-10-04 09:52 +0000
1# https://pyrocko.org - GPLv3
2#
3# The Pyrocko Developers, 21st Century
4# ---|P------/S----------~Lg----------
6'''
7Installation troubleshooting support module.
9.. note::
11 This module has been superseded by the :app:`pyrocko` command line tool.
14 .. code-block::
15 :caption: Get the installed version of Pyrocko
17 pyrocko version
19 # or when using a specific interpreter:
20 python -m pyrocko.apps.pyrocko version
22 .. code-block::
23 :caption: Get the install versions of Pyrocko's prerequisites
25 pyrocko dependencies
27 # or when using a specific interpreter:
28 python -m pyrocko.apps.pyrocko dependencies
31Running this module from the command line will print the version of the
32installed Pyrocko package or of its prerequisites.
35.. code-block::
36 :caption: Print the installed version of Pyrocko
38 python -m pyrocko.print_version
40.. code-block::
41 :caption: Print the installed versions of Pyrocko's prerequisites
43 python -m pyrocko.print_version deps
45'''
48import sys
51def print_version(deps=False):
52 import pyrocko
53 if deps:
54 print('pyrocko: %s' % pyrocko.long_version)
55 try:
56 import numpy
57 print('numpy: %s' % numpy.__version__)
58 except ImportError:
59 print('numpy: N/A')
61 try:
62 import scipy
63 print('scipy: %s' % scipy.__version__)
64 except ImportError:
65 print('scipy: N/A')
67 try:
68 import matplotlib
69 print('matplotlib: %s' % matplotlib.__version__)
70 except ImportError:
71 print('matplotlib: N/A')
73 try:
74 from pyrocko.gui.qt_compat import Qt
75 print('PyQt: %s' % Qt.PYQT_VERSION_STR)
76 print('Qt: %s' % Qt.QT_VERSION_STR)
77 except ImportError:
78 print('PyQt: N/A')
79 print('Qt: N/A')
81 try:
82 import vtk
83 print('VTK: %s' % vtk.VTK_VERSION)
84 except ImportError:
85 print('VTK: N/A')
87 print('python: %s.%s.%s' % sys.version_info[:3])
89 elif sys.argv[1:] == ['short']:
90 print(pyrocko.version)
91 else:
92 print(pyrocko.long_version)
95if __name__ == '__main__':
96 print_version(sys.argv[1:] == ['deps'])