17
17
from matplotlib .backends .backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
18
18
19
19
20
- dependencies = ['numpy' , 'pandas' , 'matplotlib' , 'larray' , 'larray_eurostat' , 'pytables' , 'xlwings' , 'xlsxwriter' ,
21
- 'xlrd' , 'openpyxl' ]
20
+ core_dependencies = ['numpy' , 'pandas' , 'matplotlib' , 'pytables' , 'xlwings' , 'xlsxwriter' , 'xlrd' , 'openpyxl' ]
21
+ editor_dependencies = ['larray' , 'larray_eurostat' , 'qt' ] + core_dependencies
22
+ eurostat_dependencies = ['larray' ]
23
+ dependencies = {'editor' : editor_dependencies , 'larray' : core_dependencies , 'larray_eurostat' : eurostat_dependencies }
24
+
22
25
23
26
urls = {"fpb" : "http://www.plan.be/index.php?lang=en" ,
24
27
"GPL3" : "https://www.gnu.org/licenses/gpl-3.0.html" ,
25
28
"doc_stable" : "http://larray.readthedocs.io/en/stable/" ,
26
29
"doc_tutorial" : "http://larray.readthedocs.io/en/stable/tutorial.html" ,
27
30
"doc_api" : "http://larray.readthedocs.io/en/stable/api.html" ,
28
- "new_issue" : "https://github.com/liam2/larray/issues/new" ,
31
+ "new_issue_editor" : "https://github.com/larray-project/larray-editor/issues/new" ,
32
+ "new_issue_larray" : "https://github.com/liam2/larray/issues/new" ,
33
+ "new_issue_larray_eurostat" : "https://github.com/larray-project/larray_eurostat/issues/new" ,
29
34
"announce_group" : "https://groups.google.com/d/forum/larray-announce" ,
30
35
"users_group" : "https://groups.google.com/d/forum/larray-users" }
31
36
@@ -37,44 +42,39 @@ def commonpath(paths):
37
42
commonpath = os .path .commonpath
38
43
39
44
40
- def get_package_version ( package_name ):
41
- """Return the version of a package if installed, N/A otherwise"""
45
+ def get_module_version ( module_name ):
46
+ """Return the version of a module if installed, N/A otherwise"""
42
47
try :
43
48
from importlib import import_module
44
- package = import_module (package_name )
45
- if '__version__' in dir (package ):
46
- return package .__version__
47
- elif '__VERSION__' in dir (package ):
48
- return package .__VERSION__
49
+ module = import_module (module_name )
50
+ if 'qtpy' in module_name :
51
+ from qtpy import API_NAME , PYQT_VERSION # API_NAME --> PyQt5 or PyQt4
52
+ qt_version = module .__version__
53
+ return '{}, {} {}' .format (qt_version , API_NAME , PYQT_VERSION )
54
+ elif '__version__' in dir (module ):
55
+ return module .__version__
56
+ elif '__VERSION__' in dir (module ):
57
+ return module .__VERSION__
49
58
else :
50
59
return 'N/A'
51
60
except ImportError :
52
61
return 'N/A'
53
62
54
63
55
- def get_versions ():
56
- """Get version information for components used by the Editor """
64
+ def get_versions (package ):
65
+ """Get version information of dependencies of a package """
57
66
import platform
58
- from qtpy import API_NAME , PYQT_VERSION
59
- from qtpy .QtCore import __version__ as qtpy_version
60
- from larray_editor import __version__ as editor_version
67
+ modules = {'editor' : 'larray_editor' , 'qt' : 'qtpy.QtCore' , 'pytables' : 'tables' }
61
68
62
69
versions = {
63
- 'editor ' : editor_version ,
70
+ 'system ' : platform . system () if sys . platform != 'darwin' else 'Darwin' ,
64
71
'python' : platform .python_version (),
65
72
'bitness' : 64 if sys .maxsize > 2 ** 32 else 32 ,
66
- 'qt' : qtpy_version ,
67
- 'qt_api' : API_NAME , # PyQt5 or PyQt4
68
- 'qt_api_ver' : PYQT_VERSION ,
69
73
}
70
74
71
- if not sys .platform == 'darwin' : # To avoid a crash with our Mac app
72
- versions ['system' ] = platform .system () # Linux, Windows, ...
73
- else :
74
- versions ['system' ] = 'Darwin'
75
-
76
- for dep in dependencies :
77
- versions [dep ] = get_package_version (dep )
75
+ versions [package ] = get_module_version (modules .get (package , package ))
76
+ for dep in dependencies [package ]:
77
+ versions [dep ] = get_module_version (modules .get (dep , dep ))
78
78
79
79
return versions
80
80
0 commit comments