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")
|
Returns ("-l flags", "-I flags", "-L flags", "version")
|
||||||
otherwise (None, None, None, None)"""
|
otherwise (None, None, None, None)"""
|
||||||
pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
|
pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
|
||||||
|
args = [] # Print pkg-config warnings on first round.
|
||||||
retval = ()
|
retval = ()
|
||||||
for flag in ['--libs-only-l', '--cflags-only-I',
|
for flag in ['--libs-only-l', '--cflags-only-I',
|
||||||
'--libs-only-L', '--modversion']:
|
'--libs-only-L', '--modversion']:
|
||||||
|
args += [flag, pkg]
|
||||||
try:
|
try:
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(shlex.split(pkg_config) + args,
|
||||||
shlex.split(pkg_config) + ['--silence-errors', flag, pkg],
|
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
val = proc.communicate()[0].strip()
|
val = proc.communicate()[0].strip()
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno != errno.ENOENT: raise e # Unexpected error.
|
if e.errno != errno.ENOENT: raise e # Unexpected error.
|
||||||
return (None, None, None, None) # No pkg-config/pkgconf installed.
|
return (None, None, None, None) # No pkg-config/pkgconf installed.
|
||||||
retval += (val,)
|
retval += (val,)
|
||||||
|
args = ['--silence-errors']
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user