Commit c60c3d98 authored by André Anjos's avatar André Anjos 💬

Scan pkg-config location before using it to avoid impromptu error message

parent 894bd61a
......@@ -7,7 +7,7 @@ import os
import sys
import subprocess
import logging
from .utils import uniq, uniq_paths
from .utils import uniq, uniq_paths, find_executable
def call_pkgconfig(cmd, paths=None):
"""Runs a command as a subprocess and raises if that does not work
......@@ -15,6 +15,11 @@ def call_pkgconfig(cmd, paths=None):
Returns the exit status, stdout and stderr.
"""
# locates the pkg-config program
pkg_config = find_executable('pkg-config')
if not pkg_config:
raise OSError("Cannot find `pkg-config' - did you install it?")
# sets the PKG_CONFIG_PATH taking into consideration:
# 1. BOB_PREFIX_PATH, if set
# 2. the paths set by the user
......@@ -43,7 +48,7 @@ def call_pkgconfig(cmd, paths=None):
env['PKG_CONFIG_PATH'] = os.pathsep.join([var, old]) if old else var
# calls the program
cmd = ['pkg-config'] + [str(k) for k in cmd]
cmd = pkg_config[:1] + [str(k) for k in cmd]
subproc = subprocess.Popen(
cmd,
env=env,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment