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

1# https://pyrocko.org - GPLv3 

2# 

3# The Pyrocko Developers, 21st Century 

4# ---|P------/S----------~Lg---------- 

5 

6''' 

7Installation troubleshooting support module. 

8 

9.. note:: 

10 

11 This module has been superseded by the :app:`pyrocko` command line tool. 

12 

13 

14 .. code-block:: 

15 :caption: Get the installed version of Pyrocko 

16 

17 pyrocko version 

18 

19 # or when using a specific interpreter: 

20 python -m pyrocko.apps.pyrocko version 

21 

22 .. code-block:: 

23 :caption: Get the install versions of Pyrocko's prerequisites 

24 

25 pyrocko dependencies 

26 

27 # or when using a specific interpreter: 

28 python -m pyrocko.apps.pyrocko dependencies 

29 

30 

31Running this module from the command line will print the version of the 

32installed Pyrocko package or of its prerequisites. 

33 

34 

35.. code-block:: 

36 :caption: Print the installed version of Pyrocko 

37 

38 python -m pyrocko.print_version 

39 

40.. code-block:: 

41 :caption: Print the installed versions of Pyrocko's prerequisites 

42 

43 python -m pyrocko.print_version deps 

44 

45''' 

46 

47 

48import sys 

49 

50 

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') 

60 

61 try: 

62 import scipy 

63 print('scipy: %s' % scipy.__version__) 

64 except ImportError: 

65 print('scipy: N/A') 

66 

67 try: 

68 import matplotlib 

69 print('matplotlib: %s' % matplotlib.__version__) 

70 except ImportError: 

71 print('matplotlib: N/A') 

72 

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') 

80 

81 try: 

82 import vtk 

83 print('VTK: %s' % vtk.VTK_VERSION) 

84 except ImportError: 

85 print('VTK: N/A') 

86 

87 print('python: %s.%s.%s' % sys.version_info[:3]) 

88 

89 elif sys.argv[1:] == ['short']: 

90 print(pyrocko.version) 

91 else: 

92 print(pyrocko.long_version) 

93 

94 

95if __name__ == '__main__': 

96 print_version(sys.argv[1:] == ['deps'])