From 308f6baa27e8162bff2e34cb042cef038eb4e850a6b298cada75bbb9b0cab866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Wed, 2 Aug 2017 16:04:59 +0000 Subject: [PATCH] Accepting request 514065 from home:cbosdonnat:branches:Virtualization - Fix python binding package * Replace python-libguestfs by python[23]-libguestfs packages * Add egg-info to python[23]-libguestfs package OBS-URL: https://build.opensuse.org/request/show/514065 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=399 --- libguestfs.changes | 3 +++ libguestfs.spec | 50 +++++++++++++++++++++++++++++++++++++--------- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/libguestfs.changes b/libguestfs.changes index a93679f..615cef1 100644 --- a/libguestfs.changes +++ b/libguestfs.changes @@ -3,6 +3,9 @@ Tue Jul 18 14:07:54 UTC 2017 - cbosdonnat@suse.com - Add missing dependency on guestfs-data (bsc#1048848) - Add conflict with old virt-v2v (bsc#1050069) +- Fix python binding package + * Replace python-libguestfs by python[23]-libguestfs packages + * Add egg-info to python[23]-libguestfs package ------------------------------------------------------------------- Mon Jul 17 07:05:10 UTC 2017 - dmueller@suse.com diff --git a/libguestfs.spec b/libguestfs.spec index 18ad20e..11e4ef9 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -302,21 +302,38 @@ Allows lua scripts to directly use libguestfs. %endif # %if %{with python_bindings} -%package -n python-libguestfs -Summary: Provides Python support for libguestfs +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%package -n python2-libguestfs +Summary: Provides Python 2 support for libguestfs License: GPL-2.0 Group: System/Filesystems -%define pyver %(python -c "import sys; print sys.version[:3]") +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} BuildRequires: python -BuildRequires: python-devel +BuildRequires: python-rpm-macros %define _configure_python --enable-python # -Provides: libguestfs-python = %{version} Obsoletes: libguestfs-python < %{version} +Obsoletes: python-libguestfs < %{version} +Provides: python-libguestfs = %{version} Requires: guestfs-data >= %{version} -%description -n python-libguestfs -Allows Python scripts to directly use libguestfs. +%description -n python2-libguestfs +Allows Python 2 scripts to directly use libguestfs. + +%package -n python3-libguestfs +Summary: Provides Python 3 support for libguestfs +License: GPL-2.0 +Group: System/Filesystems +%define _configure_python --enable-python +# +Obsoletes: libguestfs-python < %{version} +Obsoletes: python-libguestfs < %{version} +Provides: python-libguestfs = %{version} +Requires: guestfs-data >= %{version} + +%description -n python3-libguestfs +Allows Python 3 scripts to directly use libguestfs. %endif # %if %{with ruby_bindings} @@ -621,6 +638,17 @@ find $RPM_BUILD_ROOT -name "*.bs" -size 0c -print -delete grep "%perl_vendorarch/" %{name}.files | tee t mv t %{name}.files %endif + +%if %{with python_bindings} +pushd python +sed -i -e "s:libraries=:library_dirs=['$RPM_BUILD_ROOT/%{_libdir}'], libraries=:" setup.py +make stamp-extra-files +# Build needs libguestfs library to be installed +%python_build +%python_install +popd +%endif + # find $RPM_BUILD_ROOT -name "*.la" -print -delete rm -fv $RPM_BUILD_ROOT/%{_libdir}/*.a @@ -703,9 +731,13 @@ rm -rf $RPM_BUILD_ROOT %endif # %if %{with python_bindings} -%files -n python-libguestfs +%files -n python2-libguestfs %defattr(-,root,root) -%{_libdir}/python%{pyver}/site-packages/* +%{python2_sitearch}/* + +%files -n python3-libguestfs +%defattr(-,root,root) +%{python3_sitearch}/* %endif # %if %{with ruby_bindings}