1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/usr/bin/env python
from distutils.core import setup, Extension
import subprocess
import os
def pkgconfig(what):
out = []
cmd = 'pkg-config %s %s' % (what, '@PACKAGE_NAME@')
pcout = subprocess.check_output(cmd.split()).decode()
for token in pcout.split():
out.append(token[2:])
return out
cflags = ['-std=c99', '-Wno-strict-aliasing']
additional_link_args = []
# See if we're building in-tree
if os.access('Makefile.am', os.F_OK):
cflags.append('-I../include')
additional_link_args.extend(['-Wl,-L../rpmio/.libs',
'-Wl,-L../lib/.libs',
'-Wl,-L../build/.libs',
'-Wl,-L../sign/.libs'])
os.environ['PKG_CONFIG_PATH'] = '..'
rpmmod = Extension('@PYTHON_MODULENAME@._rpm',
sources = ['header-py.c', 'rpmds-py.c', 'rpmfd-py.c',
'rpmfi-py.c', 'rpmii-py.c', 'rpmkeyring-py.c',
'rpmmacro-py.c', 'rpmmi-py.c', 'rpmps-py.c',
'rpmstrpool-py.c', 'rpmfiles-py.c',
'rpmarchive-py.c', 'rpmtd-py.c',
'rpmte-py.c', 'rpmts-py.c',
'spec-py',
'rpmmodule.c'],
include_dirs = pkgconfig('--cflags'),
library_dirs = pkgconfig('--libs-only-L'),
libraries = pkgconfig('--libs-only-l') + ['rpmbuild', 'rpmsign'],
extra_compile_args = cflags,
extra_link_args = additional_link_args
)
setup(name='@PACKAGE_NAME@',
version='@VERSION@',
description='Python bindings for @PACKAGE_NAME@',
maintainer_email='@PACKAGE_BUGREPORT@',
url='http://www.rpm.org/',
packages=['@PACKAGE_NAME@'],
ext_modules=[rpmmod]
)
|