2 #-*-coding:iso-8859-1-*-
3 """Test des versions de modules"""
5 # Versions Calibre9/Jessie
6 minimal_python_version = "2.7.9"
7 minimal_numpy_version = "1.8.2"
8 minimal_scipy_version = "0.14.0"
9 minimal_matplotlib_version = "1.4.2"
11 def compare_versions(v1,v2):
12 "Comparaison v1 >= v2"
13 for s in ['+', 'rc1', 'rc2', 'rc3']:
14 v1 = v1.replace(s,'',1)
15 v2 = v2.replace(s,'',1)
16 v11,v12,v13 = map(float,v1.split('.'))
17 v21,v22,v23 = map(float,v2.split('.'))
18 lv1 = 1e6*v11 + 1e3*v12 + v13
19 lv2 = 1e6*v21 + 1e3*v22 + v23
24 print " Les versions minimales attendues sont :"
25 print " - Python systeme....: %s"%minimal_python_version
26 print " - Numpy.............: %s"%minimal_numpy_version
27 print " - Scipy.............: %s"%minimal_scipy_version
28 print " - Matplotlib........: %s"%minimal_matplotlib_version
33 "Test des versions de modules"
34 print " Les versions disponibles sont :"
36 print " - Python systeme....: %s"%v[0]
37 assert compare_versions(sys.version.split()[0], minimal_python_version)
41 print " - Numpy.............: %s"%numpy.version.version
42 assert compare_versions(numpy.version.version, minimal_numpy_version)
48 print " - Scipy.............: %s"%scipy.version.version
49 assert compare_versions(scipy.version.version, minimal_scipy_version)
55 mplversion = matplotlib.__version__
56 print " - Matplotlib........: %s"%mplversion
57 assert compare_versions(mplversion, minimal_matplotlib_version)
62 backend_now = matplotlib.get_backend()
64 for backend in ['bidon', 'pdf', 'pgf', 'Qt4Agg', 'GTK', 'GTKAgg', 'ps',
65 'agg', 'cairo', 'MacOSX', 'GTKCairo', 'WXAgg',
66 'template', 'TkAgg', 'GTK3Cairo', 'GTK3Agg', 'svg',
67 'WebAgg', 'CocoaAgg', 'emf', 'gdk', 'WX']:
69 matplotlib.use(backend)
70 backends_OK.append(backend)
72 backends_KO.append(backend)
74 print " Backends disponibles pour Matplotlib %s :"%mplversion
75 print " Defaut initial......: '%s'"%backend_now
76 print " Fonctionnant........:"
79 print " Non fonctionnant....:"
82 print " (Le backend 'bidon' n'est ici que pour verifier le test, il n'existe pas)"
89 #===============================================================================
90 if __name__ == "__main__":
92 print '\nAUTODIAGNOSTIC\n==============\n'
95 sys.exit(testSysteme())