Use cmake for compiling and installing the python modules
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=655
This commit is contained in:
parent
ea7508fb20
commit
e4c0623005
15
cmake_python_version.diff
Normal file
15
cmake_python_version.diff
Normal file
@ -0,0 +1,15 @@
|
||||
--- CMakeLists.txt.orig 2024-02-01 13:24:18.665660569 +0000
|
||||
+++ CMakeLists.txt 2024-02-01 13:25:07.917586376 +0000
|
||||
@@ -238,7 +238,11 @@ endif()
|
||||
list(APPEND db_backends dummy)
|
||||
|
||||
if (ENABLE_PYTHON)
|
||||
- find_package(Python3 3.2 COMPONENTS Interpreter Development REQUIRED)
|
||||
+ if (WITH_PYTHON_VERSION)
|
||||
+ find_package(Python3 ${WITH_PYTHON_VERSION} EXACT COMPONENTS Interpreter Development REQUIRED)
|
||||
+ else()
|
||||
+ find_package(Python3 3.2 COMPONENTS Interpreter Development REQUIRED)
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
if (WITH_CAP)
|
@ -1,7 +1,7 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 1 11:59:47 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||
Thu Feb 1 15:07:34 CET 2024 - mls@suse.de
|
||||
|
||||
- buildrequire setuptools
|
||||
- Use cmake for compiling and installing the python modules
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 30 14:13:37 UTC 2023 - Matej Cepl <mcepl@cepl.eu>
|
||||
|
@ -28,9 +28,6 @@ Group: Development/Libraries/Python
|
||||
URL: https://rpm.org/
|
||||
#Git-Clone: https://github.com/rpm-software-management/rpm
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: cmake
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: file-devel
|
||||
@ -70,18 +67,16 @@ that will manipulate RPM packages and databases.
|
||||
%prep
|
||||
%{expand:%(sed -n -e '/^%%prep/,/^%%install/p' <%{_sourcedir}/rpm.spec | sed -e '1d' -e '$d')}
|
||||
|
||||
# The build stage is already declared and pulled in from rpm.spec
|
||||
cd ..
|
||||
cp _build/python/setup.py python
|
||||
pushd python
|
||||
%pyproject_wheel
|
||||
popd
|
||||
|
||||
%install
|
||||
pushd python
|
||||
%pyproject_install
|
||||
popd
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitearch}
|
||||
cd _build
|
||||
%{python_expand #
|
||||
cmake .. -U\*Python3\* -DWITH_PYTHON_VERSION=%{$python_version}
|
||||
make DESTDIR=%{buildroot} -C python clean
|
||||
make DESTDIR=%{buildroot} -C python install
|
||||
}
|
||||
|
||||
%python_compileall
|
||||
rm -rf %{buildroot}/%{_defaultdocdir}/%{NAME}
|
||||
|
||||
%files %{python_files}
|
||||
%{python_sitearch}/rpm
|
||||
|
@ -1,64 +0,0 @@
|
||||
--- 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]
|
||||
+ )
|
||||
+
|
5
rpm.spec
5
rpm.spec
@ -111,8 +111,8 @@ Patch133: zstdpool.diff
|
||||
Patch134: zstdthreaded.diff
|
||||
Patch135: selinux_transactional_update.patch
|
||||
Patch136: rpmsort_reverse.diff
|
||||
Patch137: python_setup.diff
|
||||
Patch138: canongnu.diff
|
||||
Patch139: cmake_python_version.diff
|
||||
Patch6464: auto-config-update-aarch64-ppc64le.diff
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
#
|
||||
@ -225,7 +225,8 @@ rm -rf sqlite
|
||||
%patch -P 100 -P 102 -P 103
|
||||
%patch -P 117
|
||||
%patch -P 122 -P 123
|
||||
%patch -P 131 -P 133 -P 134 -P 135 -P 136 -P 137 -P 138
|
||||
%patch -P 131 -P 133 -P 134 -P 135 -P 136 -P 138
|
||||
%patch -P 139
|
||||
|
||||
%ifarch aarch64 ppc64le riscv64
|
||||
%patch6464
|
||||
|
Loading…
Reference in New Issue
Block a user