Ticket #22486: eintr.patch

File eintr.patch, 1.6 KB (added by celil.rufat@…, 14 years ago)

patch by Jouni K. Seppänen

  • matplotlib/font_manager.py

     
    4242            see license/LICENSE_TTFQUERY.
    4343"""
    4444
    45 import os, sys, glob
     45import os, sys, glob, subprocess
    4646try:
    4747    set
    4848except NameError:
     
    292292    grab all of the fonts the user wants to be made available to
    293293    applications, without needing knowing where all of them reside.
    294294    """
    295     try:
    296         import commands
    297     except ImportError:
    298         return {}
    299 
    300295    fontext = get_fontext_synonyms(fontext)
    301296
    302297    fontfiles = {}
    303     status, output = commands.getstatusoutput("fc-list file")
    304     if status == 0:
     298    pipe = subprocess.Popen(['fc-list', '', 'file'], stdout=subprocess.PIPE)
     299    output = pipe.communicate()[0]
     300    if pipe.returncode == 0:
    305301        for line in output.split('\n'):
    306302            fname = line.split(':')[0]
    307303            if (os.path.splitext(fname)[1][1:] in fontext and
     
    12441240    import re
    12451241
    12461242    def fc_match(pattern, fontext):
    1247         import commands
    12481243        fontexts = get_fontext_synonyms(fontext)
    12491244        ext = "." + fontext
    1250         status, output = commands.getstatusoutput('fc-match -sv "%s"' % pattern)
    1251         if status == 0:
     1245        pipe = subprocess.Popen(['fc-match', '-sv', pattern], stdout=subprocess.PIPE)
     1246        output = pipe.communicate()[0]
     1247        if pipe.returncode == 0:
    12521248            for match in _fc_match_regex.finditer(output):
    12531249                file = match.group(1)
    12541250                if os.path.splitext(file)[1][1:] in fontexts: