+#
+# Conditional build:
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
+
Summary: Shared storage lock manager
Summary(pl.UTF-8): Zarządca blokad dla współdzielonego składowania danych
Name: sanlock
-Version: 3.4.0
-Release: 1
+Version: 3.8.4
+Release: 3
License: LGPL v2+ (libsanlock_client, libwdmd), GPL v2 (libsanlock, utilities)
Group: Networking
-# older releases: https://fedorahosted.org/releases/s/a/sanlock/%{name}-%{version}.tar.gz
-#Source0Download: https://git.fedorahosted.org/cgit/sanlock.git/
-Source0: https://git.fedorahosted.org/cgit/sanlock.git/snapshot/%{name}-%{version}.tar.xz
-# Source0-md5: d882beb5f188abff545b64cc3cbe9c79
-Patch0: %{name}-link.patch
-Patch1: %{name}-init-pld.patch
-URL: https://fedorahosted.org/sanlock/
+Source0: https://releases.pagure.org/sanlock/%{name}-%{version}.tar.gz
+# Source0-md5: c064756c07a86e83119cfdd7695cf449
+Patch0: %{name}-init-pld.patch
+URL: https://pagure.io/sanlock
BuildRequires: gcc >= 5:3.4
BuildRequires: libaio-devel
BuildRequires: libblkid-devel
BuildRequires: libuuid-devel
-BuildRequires: python-devel
+%{?with_python2:BuildRequires: python-devel >= 1:2.5}
+%{?with_python3:BuildRequires: python3-devel >= 1:3.2}
BuildRequires: rpmbuild(macros) >= 1.228
BuildRequires: tar >= 1:1.22
BuildRequires: xz
Pliki nagłówkowe bibliotek sanlock.
%package -n python-sanlock
-Summary: Python binding for sanlock library
-Summary(pl.UTF-8): Wiązanie Pythona do biblioteki sanlock
+Summary: Python 2 binding for sanlock library
+Summary(pl.UTF-8): Wiązanie Pythona 2 do biblioteki sanlock
Group: Libraries/Python
Requires: %{name}-libs = %{version}-%{release}
%description -n python-sanlock
-Python binding for sanlock library.
+Python 2 binding for sanlock library.
%description -n python-sanlock -l pl.UTF-8
-Wiązanie Pythona do biblioteki sanlock.
+Wiązanie Pythona 2 do biblioteki sanlock.
+
+%package -n python3-sanlock
+Summary: Python 3 binding for sanlock library
+Summary(pl.UTF-8): Wiązanie Pythona 3 do biblioteki sanlock
+Group: Libraries/Python
+Requires: %{name}-libs = %{version}-%{release}
+
+%description -n python3-sanlock
+Python 3 binding for sanlock library.
+
+%description -n python3-sanlock -l pl.UTF-8
+Wiązanie Pythona 3 do biblioteki sanlock.
%prep
%setup -q
%patch0 -p1
-%patch1 -p1
%build
export CFLAGS="%{rpmcflags}"
LDFLAGS="%{rpmldflags}" \
OPTIMIZE_FLAG="%{rpmcflags}"
-# note (as of 3.3.0): python3 is not supported
cd python
+%if %{with python2}
%py_build
+%endif
+
+%if %{with python3}
+%py3_build
+%endif
cd ..
%install
DESTDIR=$RPM_BUILD_ROOT
cd python
+%if %{with python2}
%py_install
+%endif
+
+%if %{with python3}
+%py3_install
+%endif
cd ..
/sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir}
%{_pkgconfigdir}/libsanlock.pc
%{_pkgconfigdir}/libsanlock_client.pc
+%if %{with python2}
%files -n python-sanlock
%defattr(644,root,root,755)
%attr(755,root,root) %{py_sitedir}/sanlock.so
%{py_sitedir}/sanlock_python-%{version}_-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-sanlock
+%defattr(644,root,root,755)
+%attr(755,root,root) %{py3_sitedir}/sanlock.cpython-*.so
+%{py3_sitedir}/sanlock_python-%{version}_-py*.egg-info
+%endif