teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone
Blob Blame History Raw
--- rpm-4.11.0.1/python/setup.py.in.setuppy-fixes	2012-11-07 13:55:24.000000000 +0100
+++ rpm-4.11.0.1/python/setup.py.in	2013-04-03 14:16:48.149931703 +0200
@@ -1,13 +1,19 @@
 #!/usr/bin/env python
 
 from distutils.core import setup, Extension
+import os
 import subprocess
 from glob import glob
 
 def pkgconfig(what):
     out = []
     cmd = 'pkg-config %s %s' % (what, '@PACKAGE_NAME@')
-    pcout = subprocess.check_output(cmd.split()).decode()
+    env = dict(os.environ, **{'PKG_CONFIG_PATH': '..'})
+    proc = subprocess.Popen(cmd.split(),
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.PIPE,
+                            env=env)
+    pcout = proc.communicate()[0].decode()
     for token in pcout.split():
         out.append(token[2:])
     return out
@@ -18,7 +24,8 @@
         srcs.extend(glob('%s*.c' % n))
     return srcs
 
-cflags = ['-std=c99']
+cflags = ['-std=c99', '-I../include']
+additional_link_args = ['-Wl,-L../rpmio/.libs', '-Wl,-L../lib/.libs', '-Wl,-L../build/.libs', '-Wl,-L../sign/.libs']
 
 rpmmod = Extension('rpm._rpm',
                    sources = mksources([
@@ -28,21 +35,24 @@
                              ]),
                    include_dirs = pkgconfig('--cflags'),
                    libraries = pkgconfig('--libs'),
-                   extra_compile_args = cflags
+                   extra_compile_args = cflags,
+                   extra_link_args = additional_link_args
                   )
 
 rpmbuild_mod = Extension('rpm._rpmb',
                    sources = mksources(['rpmbmodule', 'spec']),
                    include_dirs = pkgconfig('--cflags'),
                    libraries = pkgconfig('--libs') + ['rpmbuild'],
-                   extra_compile_args = cflags
+                   extra_compile_args = cflags,
+                   extra_link_args = additional_link_args
                   )
 
 rpmsign_mod = Extension('rpm._rpms',
                    sources = mksources(['rpmbmodule']),
                    include_dirs = pkgconfig('--cflags'),
                    libraries = pkgconfig('--libs') + ['rpmsign'],
-                   extra_compile_args = cflags
+                   extra_compile_args = cflags,
+                   extra_link_args = additional_link_args
                   )
 
 setup(name='@PACKAGE_NAME@-python',