[packages/libtorrent-rasterbar] - add python3 support, rel 8

baggins baggins at pld-linux.org
Tue Aug 15 12:04:58 CEST 2023


commit 323bc1898683d4cea0a8086b3409eb01476afe2b
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Tue Aug 15 11:01:00 2023 +0200

    - add python3 support, rel 8

 libtorrent-rasterbar.spec | 61 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 58 insertions(+), 3 deletions(-)
---
diff --git a/libtorrent-rasterbar.spec b/libtorrent-rasterbar.spec
index 87e5921..ff1d06e 100644
--- a/libtorrent-rasterbar.spec
+++ b/libtorrent-rasterbar.spec
@@ -1,4 +1,9 @@
 # WARNING: qbittorrent 4.1.x uses 1.1.x/1.2.x, not 2.x
+#
+# Conditional build:
+%bcond_without	python2 # CPython 2.x module
+%bcond_without	python3 # CPython 3.x module
+
 #
 %define		tagver	%(echo %{version} | tr . _)
 Summary:	A C++ BitTorrent library
@@ -6,7 +11,7 @@ Summary(hu.UTF-8):	C++ BitTorrent könyvtár
 Summary(pl.UTF-8):	Biblioteka BitTorrenta napisana w C++
 Name:		libtorrent-rasterbar
 Version:	1.2.7
-Release:	7
+Release:	8
 Epoch:		2
 License:	BSD
 Group:		Libraries
@@ -18,13 +23,20 @@ BuildRequires:	GeoIP-devel
 BuildRequires:	autoconf >= 2.63
 BuildRequires:	automake >= 1:1.11
 BuildRequires:	boost-devel >= 1.58
-BuildRequires:	boost-python-devel >= 1.58
 BuildRequires:	libstdc++-devel >= 6:4.7
 BuildRequires:	libtool >= 2:2.2.6
 BuildRequires:	openssl-devel
 BuildRequires:	pkgconfig >= 1:0.20
+%if %{with python2}
+BuildRequires:	boost-python-devel >= 1.58
 BuildRequires:	python-devel >= 1:2.4
 BuildRequires:	python-modules >= 1:2.4
+%endif
+%if %{with python3}
+BuildRequires:	boost-python3-devel >= 1.58
+BuildRequires:	python3-devel >= 1:3.6
+BuildRequires:	python3-modules >= 1:3.6
+%endif
 BuildRequires:	rpm-pythonprov
 BuildRequires:	sed >= 4.0
 BuildRequires:	util-linux
@@ -121,6 +133,18 @@ Python bindings for libtorrent-rasterbar.
 %description -n python-libtorrent-rasterbar -l pl.UTF-8
 Wiązania Pythona do biblioteki libtorrent-rasterbar.
 
+%package -n python3-libtorrent-rasterbar
+Summary:	Python 3 bindings for libtorrent-rasterbar
+Summary(pl.UTF-8):	Wiązania Pythona 3 do biblioteki libtorrent-rasterbar
+Group:		Libraries/Python
+Requires:	%{name} = %{epoch}:%{version}-%{release}
+
+%description -n python3-libtorrent-rasterbar
+Python 3 bindings for libtorrent-rasterbar.
+
+%description -n python3-libtorrent-rasterbar -l pl.UTF-8
+Wiązania Pythona 3 do biblioteki libtorrent-rasterbar.
+
 %prep
 %setup -q
 
@@ -140,7 +164,7 @@ find -type f -regex '.*\.[hc]pp' | xargs chmod a-x
 %configure \
 	LIBS="-lpthread -lrt" \
 	--disable-silent-rules \
-	--enable-python-binding \
+	--disable-python-binding \
 	--with-asio=system \
 	--with-boost-libdir=%{_libdir} \
 	--with-boost-filesystem=boost_filesystem \
@@ -154,12 +178,34 @@ find -type f -regex '.*\.[hc]pp' | xargs chmod a-x
 
 %{__make}
 
+cd bindings/python
+
+%if %{with python2}
+%py_build
+%endif
+
+%if %{with python3}
+%py3_build
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
+cd bindings/python
+
+%if %{with python2}
+%py_install
+
+%py_postclean
+%endif
+
+%if %{with python3}
+%py3_install
+%endif
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -185,7 +231,16 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %{_libdir}/libtorrent-rasterbar.a
 
+%if %{with python2}
 %files -n python-libtorrent-rasterbar
 %defattr(644,root,root,755)
 %attr(755,root,root) %{py_sitedir}/libtorrent.so
 %{py_sitedir}/python_libtorrent-*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-libtorrent-rasterbar
+%defattr(644,root,root,755)
+%attr(755,root,root) %{py3_sitedir}/libtorrent.*.so
+%{py3_sitedir}/python_libtorrent-*.egg-info
+%endif
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libtorrent-rasterbar.git/commitdiff/323bc1898683d4cea0a8086b3409eb01476afe2b



More information about the pld-cvs-commit mailing list