summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2014-12-10 18:12:22 +0100
committerJan Pokorný <jpokorny@redhat.com>2014-12-10 18:44:34 +0100
commit1ff9385cfbc6c5182b5de2563b6625b4f3d99c0f (patch)
tree9527852962e3a006fb7bff3c259a0f0d956dee8b
parente3fd555a34b8ca59863673fb7e5733c69c17d0d4 (diff)
downloadclufter-1ff9385cfbc6c5182b5de2563b6625b4f3d99c0f.tar.gz
clufter-1ff9385cfbc6c5182b5de2563b6625b4f3d99c0f.tar.xz
clufter-1ff9385cfbc6c5182b5de2563b6625b4f3d99c0f.zip
setup: try subprocess.check_output, failback to commands.getoutput
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--__root__/setup.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/__root__/setup.py b/__root__/setup.py
index 86dcf91..408b391 100644
--- a/__root__/setup.py
+++ b/__root__/setup.py
@@ -58,10 +58,14 @@ bifilter = \
# http://code.activestate.com/recipes/502261-python-distutils-pkg-config/#c1
def pkgconfig(*packages, **kw):
- from subprocess import check_output
+ try:
+ from subprocess import check_output
+ getoutput = lambda cmd: check_output(cmd, shell=True)
+ except ImportError:
+ from commands import getoutput
flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
- for token in check_output("pkg-config --libs --cflags {0}"
- .format(' '.join(packages)), shell=True).split():
+ for token in getoutput("pkg-config --libs --cflags {0}"
+ .format(' '.join(packages))).split():
if token[:2] in flag_map:
kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])
else: # throw others to extra_link_args