Skip to content

Commit

Permalink
build: don't swallow pkg-config warnings
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
bnoordhuis authored and targos committed Jun 18, 2019
1 parent df9b253 commit 02fdf5c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 02fdf5c

Please sign in to comment.