diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2011-03-09 15:37:07 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2011-03-09 15:37:07 +0200 |
commit | 16aea81dc77fece89766065d70dcff3ce9a640a7 (patch) | |
tree | 629725fb3b52a803c1fd430ca9be6092b9754ffd /python/setup.py.in | |
parent | 9aef00d3415dc3c588a4de3bc6a0f58e7473ded7 (diff) | |
download | librpm-tizen-16aea81dc77fece89766065d70dcff3ce9a640a7.tar.gz librpm-tizen-16aea81dc77fece89766065d70dcff3ce9a640a7.tar.bz2 librpm-tizen-16aea81dc77fece89766065d70dcff3ce9a640a7.zip |
Preliminary distutils support for the python bindings
- Steps towards separating rpm-python from the main rpm tarball even
though developed within the rpm repository.
- Having the bindings in a separate tarball makes it simpler to build
them for different python versions, notably python 3 (RhBug:531543)
Diffstat (limited to 'python/setup.py.in')
-rw-r--r-- | python/setup.py.in | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/python/setup.py.in b/python/setup.py.in new file mode 100644 index 000000000..619b0ac73 --- /dev/null +++ b/python/setup.py.in @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +from distutils.core import setup, Extension +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() + for token in pcout.split(): + out.append(token[2:]) + return out + +def mksources(names): + srcs = [] + for n in names: + srcs.extend(glob('%s*.c' % n)) + return srcs + +cflags = ['-std=c99'] + +rpmmod = Extension('rpm._rpm', + sources = mksources([ + 'header', 'rpmds', 'rpmfd', 'rpmfi', 'rpmii', + 'rpmkeyring', 'rpmmacro', 'rpmmi', 'rpmps', + 'rpmtd', 'rpmte', 'rpmts', 'rpmmodule', + ]), + include_dirs = pkgconfig('--cflags'), + libraries = pkgconfig('--libs'), + extra_compile_args = cflags + ) + +rpmbuild_mod = Extension('rpm._rpmb', + sources = mksources(['rpmbmodule', 'spec']), + include_dirs = pkgconfig('--cflags'), + libraries = pkgconfig('--libs') + ['rpmbuild'], + extra_compile_args = cflags + ) + +rpmsign_mod = Extension('rpm._rpms', + sources = mksources(['rpmbmodule']), + include_dirs = pkgconfig('--cflags'), + libraries = pkgconfig('--libs') + ['rpmsign'], + extra_compile_args = cflags + ) + +setup(name='@PACKAGE_NAME@-python', + 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, rpmsign_mod] + ) |