rpm/python_setup.diff

65 lines
2.5 KiB
Diff

--- python/CMakeLists.txt.orig 2023-10-11 14:55:22.453584792 +0000
+++ python/CMakeLists.txt 2023-10-11 14:56:41.989429746 +0000
@@ -28,5 +28,6 @@ install(DIRECTORY examples TYPE DOC)
set(egginfo ${PROJECT_NAME}-${PROJECT_VERSION}-py${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}.egg-info)
configure_file(rpm.egg-info.in ${egginfo} @ONLY)
+configure_file(setup.py.in setup.py @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${egginfo}
DESTINATION ${Python3_SITEARCH})
--- python/setup.py.in.orig 2023-10-11 14:55:17.769593923 +0000
+++ python/setup.py.in 2023-10-11 14:58:39.401200867 +0000
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+from distutils.core import setup, Extension
+import subprocess
+import os
+
+def pkgconfig(what):
+ out = []
+ cmd = 'pkg-config %s %s' % (what, '@PROJECT_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 True:
+ cflags.append('-I../include')
+ additional_link_args.extend(['-Wl,-L../_build/rpmio',
+ '-Wl,-L../_build/lib',
+ '-Wl,-L../_build/build',
+ '-Wl,-L../_build/sign'])
+ os.environ['PKG_CONFIG_PATH'] = '../_build'
+
+rpmmod = Extension('rpm._rpm',
+ sources = ['header-py.c', 'rpmds-py.c', 'rpmfd-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', 'rpmver-py.c',
+ 'spec-py.c',
+ '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='@PROJECT_NAME@',
+ version='@PROJECT_VERSION@',
+ description='Python bindings for rpm',
+ maintainer_email='rpm-maint@lists.rpm.org',
+ url='@PROJECT_HOMEPAGE_URL@',
+ license='GNU General Public License v2',
+ packages=['rpm'],
+ ext_modules=[rpmmod]
+ )
+