@@ -452,7 +452,8 @@ def checkdep_ghostscript():
452
452
stdin , stdout = os .popen4 (command )
453
453
line = stdout .readlines ()[0 ]
454
454
v = line .split ()[2 ]
455
- float (v )
455
+ vtest = '.' .join (v .split ('.' )[:2 ]) # deal with version numbers like '7.07.1'
456
+ float (vtest )
456
457
if v >= '8.16' : return True
457
458
else :
458
459
verbose .report (line + '\n Ghostscript-8.16 or later not found!\n ' , 'helpful' )
@@ -479,9 +480,12 @@ def checkdep_tex():
479
480
try :
480
481
stdin , stdout = os .popen4 ('tex -v' )
481
482
line = stdout .readlines ()[0 ]
482
- v = line .split ()[1 ]
483
- float (v )
484
- if v >= '3.1415' : return True
483
+ v = 0.0 # no version installed until we find one...
484
+ for potential_version_numstr in line .split ():
485
+ if potential_version_numstr .startswith ('3.1' ):
486
+ v = float (potential_version_numstr )
487
+ break # found version number
488
+ if v >= 3.1415 : return True
485
489
else :
486
490
verbose .report (line + '\n TeX not found!\
487
491
Please install the appropriate package for your platform.\n ' , 'helpful' )
@@ -688,13 +692,14 @@ def validate_usetex(s):
688
692
raise 'DependencyError' , 'matplotlibrc text.usetex can not \
689
693
be set to True unless TeX/LaTeX is available on your system'
690
694
if not checkdep_dvipng ():
691
- raise 'DependencyError' , 'matplotlibrc text.usetex can not \
692
- be set to True unless dvipng-1.5 or later is available on your system'
695
+ warnings . warn ( 'matplotlibrc text.usetex can not \
696
+ be be used with *Agg backend unless dvipng-1.5 or later is available on your system' )
693
697
if not checkdep_ghostscript ():
694
- raise 'DependencyError' , 'matplotlibrc text.usetex can not \
695
- be set to True unless ghostscript-8.16 or later is available on your system'
698
+ warnings .warn ('matplotlibrc text.usetex can not \
699
+ be be used with ps backend unless ghostscript-8.16 or later is available on your system' )
700
+ return bl
701
+ else :
696
702
return bl
697
- else : return bl
698
703
699
704
validate_joinstyle = ValidateInStrings (['miter' , 'round' , 'bevel' ], ignorecase = True )
700
705
@@ -942,7 +947,7 @@ def matplotlib_fname():
942
947
943
948
944
949
945
- def rc_params ():
950
+ def rc_params (fail_on_error = False ):
946
951
'Return the default params updated from the values in the rc file'
947
952
948
953
deprecated_map = {
@@ -990,13 +995,18 @@ def rc_params():
990
995
ind = val .find ('#' )
991
996
if ind >= 0 : val = val [:ind ] # ignore trailing comments
992
997
val = val .strip ()
993
- try : cval = converter (val ) # try to convert to proper type or raise
994
- except Exception , msg :
995
- warnings .warn ('Bad val "%s" on line #%d\n \t "%s"\n \t in file "%s"\n \t %s' % (val , cnt , line , fname , msg ))
996
- continue
997
- else :
998
- # Alles Klar, update dict
998
+ if fail_on_error :
999
+ cval = converter (val ) # try to convert to proper type or raise
999
1000
defaultParams [key ][0 ] = cval
1001
+ else :
1002
+ try : cval = converter (val ) # try to convert to proper type or raise
1003
+ except Exception , msg :
1004
+ warnings .warn ('Bad val "%s" on line #%d\n \t "%s"\n \t in file "%s"\n \t %s' % (
1005
+ val , cnt , line , fname , msg ))
1006
+ continue
1007
+ else :
1008
+ # Alles Klar, update dict
1009
+ defaultParams [key ][0 ] = cval
1000
1010
1001
1011
# strip the conveter funcs and return
1002
1012
ret = dict ([ (key , tup [0 ]) for key , tup in defaultParams .items ()])
0 commit comments