Capture pkg-config output even if only one component returned

Changing pkg-config output parser in case it returns only one component
(only -I or only -L)
This commit is contained in:
Konstantin Kopachev 2018-07-06 17:07:19 -07:00
parent 4407cb6507
commit 9cdfac4454
No known key found for this signature in database
GPG Key ID: CECF757E656F4F62

View File

@ -154,8 +154,8 @@ def _pkg_config(name):
]
if not DEBUG:
command.append('--silence-errors')
libs = subprocess.check_output(command).decode('utf8').split(' ')
return libs[1][2:].strip(), libs[0][2:].strip()
libs = subprocess.check_output(command).decode('utf8')
return re.match(r'(?:-L([^\s]+))?\s*(?:-I([^\s]+))?', libs).groups()
except Exception:
pass