build: don't swallow pkg-config warnings
PR-URL: https://github.com/nodejs/node/pull/28118 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
b6148402d4
commit
16edec8cfa
@ -628,18 +628,20 @@ def pkg_config(pkg):
|
||||
Returns ("-l flags", "-I flags", "-L flags", "version")
|
||||
otherwise (None, None, None, None)"""
|
||||
pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
|
||||
args = [] # Print pkg-config warnings on first round.
|
||||
retval = ()
|
||||
for flag in ['--libs-only-l', '--cflags-only-I',
|
||||
'--libs-only-L', '--modversion']:
|
||||
args += [flag, pkg]
|
||||
try:
|
||||
proc = subprocess.Popen(
|
||||
shlex.split(pkg_config) + ['--silence-errors', flag, pkg],
|
||||
stdout=subprocess.PIPE)
|
||||
proc = subprocess.Popen(shlex.split(pkg_config) + args,
|
||||
stdout=subprocess.PIPE)
|
||||
val = proc.communicate()[0].strip()
|
||||
except OSError as e:
|
||||
if e.errno != errno.ENOENT: raise e # Unexpected error.
|
||||
return (None, None, None, None) # No pkg-config/pkgconf installed.
|
||||
retval += (val,)
|
||||
args = ['--silence-errors']
|
||||
return retval
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user