Skip to content

Commit

Permalink
Merge pull request #6 from AndreyMZ/master
Browse files Browse the repository at this point in the history
Fix splitting the output of pkg-config when it contains special shell characters
  • Loading branch information
AMDmi3 authored Feb 25, 2021
2 parents 9dfd799 + e37058f commit 2933a0e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3

import shlex
import subprocess
import sys
from os import path
Expand All @@ -12,7 +13,8 @@

def pkgconfig(package):
result = {}
for token in subprocess.check_output(['pkg-config', '--libs', '--cflags', package]).decode('utf-8').split():
pkg_config_output = subprocess.check_output(['pkg-config', '--libs', '--cflags', package]).decode('utf-8')
for token in shlex.split(pkg_config_output):
if token.startswith('-I'):
result.setdefault('include_dirs', []).append(token[2:])
elif token.startswith('-L'):
Expand Down

0 comments on commit 2933a0e

Please sign in to comment.