@@ -423,11 +423,20 @@ def wrapper(*args, **kwargs):
423
423
424
424
425
425
_ExecInfo = namedtuple ("_ExecInfo" , "executable version" )
426
+ # Moved out to allow unit-testing.
427
+ _version_regexes = {
428
+ "dvipng" : "(?m)^dvipng .* (.+)" ,
429
+ "gs" : "(.*)" ,
430
+ "inkscape" : "^Inkscape ([^ ]*)" ,
431
+ "luatex" : r"^This is LuaTeX, Version (?:beta-)?(\d+\.\d+\.\d+)" ,
432
+ "pdftops" : "^pdftops version (.*)" ,
433
+ }
426
434
427
435
428
436
@functools .lru_cache ()
429
437
def get_executable_info (name ):
430
- """Get the version of some executables that Matplotlib depends on.
438
+ """
439
+ Get the version of some executables that Matplotlib depends on.
431
440
432
441
.. warning:
433
442
The list of executables that this function supports is set according to
@@ -437,8 +446,8 @@ def get_executable_info(name):
437
446
----------
438
447
name : str
439
448
The executable to query. The following values are currently supported:
440
- "dvipng", "gs", "inkscape", "pdftops", "tex". This list is subject to
441
- change without notice.
449
+ "dvipng", "gs", "inkscape", "luatex", " pdftops", "tex". This list is
450
+ subject to change without notice.
442
451
443
452
Returns
444
453
-------
@@ -473,19 +482,23 @@ def impl(args, regex, min_ver=None):
473
482
return None
474
483
475
484
if name == "dvipng" :
476
- info = impl (["dvipng" , "-version" ], "(?m)^ dvipng .* (.+)" , "1.6" )
485
+ info = impl (["dvipng" , "-version" ], _version_regexes [ " dvipng" ] , "1.6" )
477
486
elif name == "gs" :
478
487
execs = (["gswin32c" , "gswin64c" , "mgs" , "gs" ] # "mgs" for miktex.
479
488
if sys .platform == "win32" else
480
489
["gs" ])
481
- info = next ((info for info in (impl ([e , "--version" ], "(.*)" , "9" )
482
- for e in execs )
483
- if info ),
484
- None )
490
+ info = next (
491
+ (info for info in (
492
+ impl ([e , "--version" ], _version_regexes ["gs" ], "9" )
493
+ for e in execs )
494
+ if info ),
495
+ None )
485
496
elif name == "inkscape" :
486
- info = impl (["inkscape" , "-V" ], "^Inkscape ([^ ]*)" )
497
+ info = impl (["inkscape" , "-V" ], _version_regexes ["inkscape" ])
498
+ elif name == "luatex" :
499
+ info = impl (["luatex" , "--version" ], _version_regexes ["luatex" ])
487
500
elif name == "pdftops" :
488
- info = impl (["pdftops" , "-v" ], "^ pdftops version (.*)" )
501
+ info = impl (["pdftops" , "-v" ], _version_regexes [ " pdftops" ] )
489
502
if info and not ("3.0" <= info .version
490
503
# poppler version numbers.
491
504
or "0.9" <= info .version <= "1.0" ):
@@ -502,7 +515,8 @@ def impl(args, regex, min_ver=None):
502
515
503
516
504
517
def get_all_executable_infos ():
505
- """Query all executables that Matplotlib may need.
518
+ """
519
+ Query all executables that Matplotlib may need.
506
520
507
521
.. warning:
508
522
The list of executables that this function queries is set according to
@@ -515,7 +529,8 @@ def get_all_executable_infos():
515
529
to change without notice.
516
530
"""
517
531
return {name : get_executable_info (name )
518
- for name in ["dvipng" , "gs" , "inkscape" , "pdftops" , "tex" ]}
532
+ for name in ["dvipng" , "gs" , "inkscape" , "luatex" , "pdftops" ,
533
+ "tex" ]}
519
534
520
535
521
536
@cbook .deprecated ("3.0" )
0 commit comments