-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py.in
58 lines (51 loc) · 2.05 KB
/
setup.py.in
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
52
53
54
55
56
57
58
#!/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
includedirs = []
librarydirs = []
definemacros = [("HAVE_CONFIG_H", "1")]
# See if we're building in-tree
if os.access('Makefile.am', os.F_OK):
includedirs.extend(('..', '.', '../lib', '../build', '../rpmconstant', '../rpmdb', '../rpmio'))
librarydirs.extend(('../rpmio/.libs',
'../lib/.libs',
'../build/.libs',
'../rpmdb/.libs',
'../rpmconstant/.libs'))
os.environ['PKG_CONFIG_PATH'] = '..'
else:
includedirs.extend(pkgconfig('--cflags'))
rpmmod = Extension('rpm._rpm',
sources = [ 'header-py.c', 'rpmds-py.c', 'rpmfd-py.c',
'rpmfi-py.c', 'rpmfts-py.c', 'rpmkeyring-py.c',
'rpmmacro-py.c', 'rpmmi-py.c', 'rpmps-py.c',
'rpmtd-py.c', 'rpmte-py.c', 'rpmts-py.c', 'rpmmodule.c',
],
include_dirs = includedirs,
libraries = pkgconfig('--libs'),
library_dirs = librarydirs,
define_macros = definemacros,
)
rpmbuild_mod = Extension('rpm._rpmb',
sources = ['rpmbmodule.c', 'spec-py.c'],
include_dirs = includedirs,
libraries = pkgconfig('--libs'),
library_dirs = librarydirs,
define_macros = definemacros,
)
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, rpmbuild_mod]
)