Skip to content

Commit

Permalink
Fix previous EINTR fix in case fc-list cannot be run
Browse files Browse the repository at this point in the history
svn path=/trunk/matplotlib/; revision=7955
  • Loading branch information
jkseppan committed Nov 12, 2009
1 parent f437de6 commit 8c200da
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,13 @@ def get_fontconfig_fonts(fontext='ttf'):
fontext = get_fontext_synonyms(fontext)

fontfiles = {}
pipe = subprocess.Popen(['fc-list', '', 'file'], stdout=subprocess.PIPE)
output = pipe.communicate()[0]
try:
pipe = subprocess.Popen(['fc-list', '', 'file'], stdout=subprocess.PIPE)
output = pipe.communicate()[0]
except OSError:
# Calling fc-list did not work, so we'll just return nothing
return fontfiles

if pipe.returncode == 0:
for line in output.split('\n'):
fname = line.split(':')[0]
Expand Down Expand Up @@ -1242,8 +1247,11 @@ def is_opentype_cff_font(filename):
def fc_match(pattern, fontext):
fontexts = get_fontext_synonyms(fontext)
ext = "." + fontext
pipe = subprocess.Popen(['fc-match', '-sv', pattern], stdout=subprocess.PIPE)
output = pipe.communicate()[0]
try:
pipe = subprocess.Popen(['fc-match', '-sv', pattern], stdout=subprocess.PIPE)
output = pipe.communicate()[0]
except OSError:
return None
if pipe.returncode == 0:
for match in _fc_match_regex.finditer(output):
file = match.group(1)
Expand Down

0 comments on commit 8c200da

Please sign in to comment.