1 # -*- coding: utf-8 -*-
3 # Copyright (C) 2008-2019 EDF R&D
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
22 "Test des versions de modules"
24 # ==============================================================================
26 # Versions minimales Calibre9/Jessie
27 # ----------------------------------
28 minimal_python_version = "2.7.9"
29 minimal_numpy_version = "1.8.2"
30 minimal_scipy_version = "0.14.0"
31 minimal_matplotlib_version = "1.4.2"
33 def compare_versions(v1,v2):
34 "Comparaison v1 >= v2"
35 for s in ['+', 'rc1', 'rc2', 'rc3']:
36 v1 = v1.replace(s,'',1)
37 v2 = v2.replace(s,'',1)
38 v11,v12,v13 = list(map(float,v1.split('.')))
39 v21,v22,v23 = list(map(float,v2.split('.')))
40 lv1 = 1e6*v11 + 1e3*v12 + v13
41 lv2 = 1e6*v21 + 1e3*v22 + v23
46 print(" Les versions minimales attendues sont :")
47 print(" - Python systeme....: %s"%minimal_python_version)
48 print(" - Numpy.............: %s"%minimal_numpy_version)
49 print(" - Scipy.............: %s"%minimal_scipy_version)
50 print(" - Matplotlib........: %s"%minimal_matplotlib_version)
55 "Test des versions de modules"
56 print(" Les versions disponibles sont :")
58 print(" - Python systeme....: %s"%v[0])
59 assert compare_versions(sys.version.split()[0], minimal_python_version)
63 print(" - Numpy.............: %s"%numpy.version.version)
64 assert compare_versions(numpy.version.version, minimal_numpy_version)
70 print(" - Scipy.............: %s"%scipy.version.version)
71 assert compare_versions(scipy.version.version, minimal_scipy_version)
77 mplversion = matplotlib.__version__
78 print(" - Matplotlib........: %s"%mplversion)
79 assert compare_versions(mplversion, minimal_matplotlib_version)
84 backend_now = matplotlib.get_backend()
86 for backend in ['bidon', 'pdf', 'pgf', 'Qt4Agg', 'GTK', 'GTKAgg', 'ps',
87 'agg', 'cairo', 'MacOSX', 'GTKCairo', 'WXAgg',
88 'template', 'TkAgg', 'GTK3Cairo', 'GTK3Agg', 'svg',
89 'WebAgg', 'CocoaAgg', 'emf', 'gdk', 'WX']:
91 matplotlib.use(backend)
92 backends_OK.append(backend)
94 backends_KO.append(backend)
96 print(" Backends disponibles pour Matplotlib %s :"%mplversion)
97 print(" Defaut initial......: '%s'"%backend_now)
98 print(" Fonctionnant........:")
101 print(" Non fonctionnant....:")
102 for b in backends_KO:
104 print(" (Le backend 'bidon' n'est ici que pour verifier le test, il n'existe pas)")
108 print(" Les résultats obtenus sont corrects.")
113 # ==============================================================================
114 if __name__ == "__main__":
115 print('\nAUTODIAGNOSTIC\n')
117 sys.exit(testSysteme())