Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5728b56

Browse files
committed
Change checks to more closly match the original
1 parent cd3b775 commit 5728b56

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/matplotlib/__init__.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,10 @@ def checkdep_pdftops():
386386
s = subprocess.Popen(['pdftops','-v'], stdout=subprocess.PIPE,
387387
stderr=subprocess.PIPE)
388388
stdout, stderr = s.communicate()
389-
if b'version' in stderr:
390-
line = stderr.decode('ascii').split('\n')[0]
391-
v = line.split()[-1]
389+
lines = stderr.decode('ascii').split('\n')
390+
for line in lines:
391+
if 'version' in line:
392+
v = line.split()[-1]
392393
return v
393394
except (IndexError, ValueError, UnboundLocalError, OSError):
394395
return None
@@ -398,8 +399,10 @@ def checkdep_inkscape():
398399
s = subprocess.Popen(['inkscape','-V'], stdout=subprocess.PIPE,
399400
stderr=subprocess.PIPE)
400401
stdout, stderr = s.communicate()
401-
if b'Inkscape' in stdout:
402-
v = stdout.split()[1].decode('ascii')
402+
lines = stdout.decode('ascii').split('\n')
403+
for line in lines:
404+
if 'Inkscape' in line:
405+
v = line.split()[1]
403406
return v
404407
except (IndexError, ValueError, UnboundLocalError, OSError):
405408
return None
@@ -409,9 +412,10 @@ def checkdep_xmllint():
409412
s = subprocess.Popen(['xmllint','--version'], stdout=subprocess.PIPE,
410413
stderr=subprocess.PIPE)
411414
stdout, stderr = s.communicate()
412-
if b'version' in stderr:
413-
line = stderr.decode('ascii').split('\n')[0]
414-
v = line.split()[-1]
415+
lines = stderr.decode('ascii').split('\n')
416+
for line in lines:
417+
if 'version' in line:
418+
v = line.split()[-1]
415419
return v
416420
except (IndexError, ValueError, UnboundLocalError, OSError):
417421
return None

0 commit comments

Comments
 (0)