dependencies: make the hdf5 dependency use Popen_safe

It is, after all, "safe". ;) That's why it exists. There's no reason to
think listing all pkg-config entries cannot print unicode descriptions,
it's absolutely possible, and we should handle it properly if we
encounter it.
This commit is contained in:
Eli Schwartz 2022-11-02 20:45:25 -04:00
parent 535bd377b4
commit c95001b130
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
1 changed files with 3 additions and 4 deletions

View File

@ -21,7 +21,7 @@ import shutil
import subprocess
from pathlib import Path
from ..mesonlib import OrderedSet, join_args
from ..mesonlib import Popen_safe, OrderedSet, join_args
from .base import DependencyException, DependencyMethods
from .configtool import ConfigToolDependency
from .pkgconfig import PkgConfigDependency
@ -163,10 +163,9 @@ def hdf5_factory(env: 'Environment', for_machine: 'MachineChoice',
PCEXE = shutil.which('pkg-config')
if PCEXE:
# some distros put hdf5-1.2.3.pc with version number in .pc filename.
ret = subprocess.run([PCEXE, '--list-all'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
text=True)
ret, stdout, _ = Popen_safe([PCEXE, '--list-all'], stderr=subprocess.DEVNULL)
if ret.returncode == 0:
for pkg in ret.stdout.split('\n'):
for pkg in stdout.split('\n'):
if pkg.startswith('hdf5'):
pkgconfig_files.add(pkg.split(' ', 1)[0])