From: Michael Schroeder Date: Thu, 25 Jan 2024 13:27:36 +0000 (+0100) Subject: Build for multiple python versions for SUSE X-Git-Tag: 0.7.28~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08569627bb832d487a13d7c4a7fbe3956b9a6759;p=thirdparty%2Flibsolv.git Build for multiple python versions for SUSE --- diff --git a/package/libsolv.spec.in b/package/libsolv.spec.in index 6bcb4485..9b571e70 100644 --- a/package/libsolv.spec.in +++ b/package/libsolv.spec.in @@ -35,14 +35,23 @@ %else %bcond_with richdeps %endif +%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150400 +%bcond_without python_singlespec +%{?sle15allpythons} +%endif # we need at least swig 1.3.40 for the bindings ($typemap support) %if 0%{?suse_version} != 1110 +%if %{with python_singlespec} +%bcond_with python +%bcond_with python3 +%else %bcond_without python3 %if 0%{?suse_version} < 1550 %bcond_without python %else %bcond_with python %endif +%endif %bcond_without ruby %bcond_without perl %else @@ -101,6 +110,11 @@ BuildRequires: python3-devel BuildRequires: swig %endif +%if %{with python_singlespec} +BuildRequires: %{python_module devel} +BuildRequires: swig +%endif + %if %{with bz2} %if 0%{?suse_version} BuildRequires: libbz2-devel @@ -117,6 +131,11 @@ BuildRequires: xz-devel BuildRequires: libzstd-devel %endif +%if %{with python_singlespec} +%define python_subpackage_only 1 +%python_subpackages +%endif + %description libsolv is a library for solving packages and reading repositories. The solver uses a satisfiability algorithm. @@ -193,12 +212,14 @@ Group: Development/Languages/Python %description -n python-solv Python bindings for libsolv. +%if %{with python3} %package -n python3-solv Summary: Python3 bindings for the libsolv library Group: Development/Languages/Python %description -n python3-solv Python3 bindings for libsolv. +%endif %package -n perl-solv Summary: Perl bindings for the libsolv library @@ -263,6 +284,15 @@ ln -s repo2solv %{buildroot}/%{_bindir}/repo2solv.sh %py3_compile %{buildroot}/%{python3_sitearch} %endif %endif +%if %{with python_singlespec} +%{python_expand +pyver=%%python_version +cmake -U '*PYTHON*' -DENABLE_PYTHON=1 -DPYTHON_VERSION_MAJOR=${pyver%%.*} -DPYTHON_VERSION_MINOR=${pyver#*.} +make DESTDIR=%{buildroot} -C bindings/python install +} +%python_compileall +%endif + %check make ARGS=--output-on-failure test @@ -341,4 +371,14 @@ make ARGS=--output-on-failure test %endif %endif +%if %{with python_singlespec} +%files %{python_files solv} +%defattr(-,root,root) +%{python_sitearch}/* +%if 0%{?suse_version} +%{python_sitearch}/*/*solv* +%endif +%endif + + %changelog