@@ -648,65 +648,69 @@ def validate_ps_distiller(s):
648648 gs_v = checkdep_ghostscript ()
649649 if compare_versions (gs_v , gs_sugg ): pass
650650 elif compare_versions (gs_v , gs_req ):
651- verbose .report ( 'ghostscript-%s found. ghostscript-%s or later \
652- is recommended to use the ps.usedistiller option.' % (gs_v , gs_sugg ))
651+ verbose .report (( 'ghostscript-%s found. ghostscript-%s or later '
652+ ' is recommended to use the ps.usedistiller option.') % (gs_v , gs_sugg ))
653653 else :
654654 flag = False
655- warnings .warn ('matplotlibrc ps.usedistiller option can not be used \
656- unless ghostscript-%s or later is installed on your system'% gs_req )
655+ warnings .warn (( 'matplotlibrc ps.usedistiller option can not be used '
656+ ' unless ghostscript-%s or later is installed on your system') % gs_req )
657657
658658 if s == 'xpdf' :
659659 pdftops_req = '3.0'
660660 pdftops_v = checkdep_pdftops ()
661661 if compare_versions (pdftops_v , pdftops_req ): pass
662662 else :
663663 flag = False
664- warnings .warn ('matplotlibrc ps.usedistiller can not be set to \
665- xpdf unless xpdf-%s or later is installed on your system' % pdftops_req )
664+ warnings .warn (( 'matplotlibrc ps.usedistiller can not be set to '
665+ ' xpdf unless xpdf-%s or later is installed on your system') % pdftops_req )
666666
667- if flag : return s
668- else : return None
667+ if flag :
668+ return s
669+ else :
670+ return None
669671 else :
670- raise ValueError ('matplotlibrc ps.usedistiller must either be none, \
671- ghostscript or xpdf' )
672+ raise ValueError ('matplotlibrc ps.usedistiller must either be none, '
673+ ' ghostscript or xpdf' )
672674
673675def validate_usetex (s ):
674- bl = validate_bool (s )
675- if bl :
676- tex_req = '3.1415'
677- gs_req = '7.07'
678- gs_sugg = '7.07'
679- dvipng_req = '1.5'
680- flag = True
681-
682- tex_v = checkdep_tex ()
683- if compare_versions (tex_v , tex_req ): pass
684- else :
685- flag = False
686- warnings .warn ('matplotlibrc text.usetex option can not be used \
687- unless TeX-%s or later is installed on your system' % tex_req )
676+ if not validate_bool (s ):
677+ return False
688678
689- dvipng_v = checkdep_dvipng ()
690- if compare_versions (dvipng_v , dvipng_req ): pass
691- else :
692- flag = False
693- warnings .warn ( 'matplotlibrc text.usetex can not be used with *Agg \
694- backend unless dvipng-1.5 or later is installed on your system' )
679+ tex_req = '3.1415'
680+ gs_req = '7.07'
681+ gs_sugg = '7.07'
682+ dvipng_req = '1.5'
683+ flag = True
695684
696- gs_v = checkdep_ghostscript ()
697- if compare_versions (gs_v , gs_sugg ): pass
698- elif compare_versions (gs_v , gs_req ):
699- verbose .report ( 'ghostscript-%s found. ghostscript-%s or later is \
700- recommended for use with the text.usetex option.' % (gs_v , gs_sugg ))
701- else :
702- flag = False
703- warnings .warn ('matplotlibrc text.usetex can not be used \
704- unless ghostscript-%s or later is installed on your system'% gs_req )
685+ tex_v = checkdep_tex ()
686+ if compare_versions (tex_v , tex_req ): pass
687+ else :
688+ flag = False
689+ warnings .warn (('matplotlibrc text.usetex option can not be used '
690+ 'unless TeX-%s or later is '
691+ 'installed on your system' ) % tex_req )
705692
706- if flag : return True
707- else : return False
693+ dvipng_v = checkdep_dvipng ()
694+ if compare_versions ( dvipng_v , dvipng_req ): pass
708695 else :
709- return bl
696+ flag = False
697+ warnings .warn ( 'matplotlibrc text.usetex can not be used with *Agg '
698+ 'backend unless dvipng-1.5 or later is '
699+ 'installed on your system' )
700+
701+ gs_v = checkdep_ghostscript ()
702+ if compare_versions (gs_v , gs_sugg ): pass
703+ elif compare_versions (gs_v , gs_req ):
704+ verbose .report (('ghostscript-%s found. ghostscript-%s or later is '
705+ 'recommended for use with the text.usetex '
706+ 'option.' ) % (gs_v , gs_sugg ))
707+ else :
708+ flag = False
709+ warnings .warn (('matplotlibrc text.usetex can not be used '
710+ 'unless ghostscript-%s or later is '
711+ 'installed on your system' ) % gs_req )
712+
713+ return flag
710714
711715validate_joinstyle = ValidateInStrings ('joinstyle' ,['miter' , 'round' , 'bevel' ], ignorecase = True )
712716
0 commit comments