8000 Fix previous EINTR fix in case fc-list cannot be run · matplotlib/matplotlib@8c200da · GitHub
[go: up one dir, main page]

Skip to content

Commit 8c200da

Browse files
committed
Fix previous EINTR fix in case fc-list cannot be run
svn path=/trunk/matplotlib/; revision=7955
1 parent f437de6 commit 8c200da

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/matplotlib/font_manager.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,13 @@ def get_fontconfig_fonts(fontext='ttf'):
295295
fontext = get_fontext_synonyms(fontext)
296296

297297
fontfiles = {}
298-
pipe = subprocess.Popen(['fc-list', '', 'file'], stdout=subprocess.PIPE)
299-
output = pipe.communicate()[0]
298+
try:
299+
pipe = subprocess.Popen(['fc-list', '', 'file'], stdout=subprocess.PIPE)
300+
output = pipe.communicate()[0]
301+
except OSError:
302+
# Calling fc-list did not work, so we'll just return nothing
303+
return fontfiles
304+
300305
if pipe.returncode == 0:
301306
for line in output.split('\n'):
302307
fname = line.split(':')[0]
@@ -1242,8 +1247,11 @@ def is_opentype_cff_font(filename):
12421247
def fc_match(pattern, fontext):
12431248
fontexts = get_fontext_synonyms(fontext)
12441249
ext = "." + fontext
1245-
pipe = subprocess.Popen(['fc-match', '-sv', pattern], stdout=subprocess.PIPE)
1246-
output = pipe.communicate()[0]
1250+
try:
1251+
pipe = subprocess.Popen(['fc-match', '-sv', pattern], stdout=subprocess.PIPE)
1252+
output = pipe.communicate()[0]
1253+
except OSError:
1254+
return None
12471255
if pipe.returncode == 0:
12481256
for match in _fc_match_regex.finditer(output):
12491257
file = match.group(1)

0 commit comments

Comments
 (0)
0