[packages/libsvm] - updated to 3.3 (as 3.30; new sonames, changed python packaging)

qboosh qboosh at pld-linux.org
Wed Jan 18 16:30:31 CET 2023


commit b99baac4f3d052c1184103c0e35a4d7a5190658a
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Wed Jan 18 16:31:32 2023 +0100

    - updated to 3.3 (as 3.30; new sonames, changed python packaging)

 libsvm-python.patch | 73 +++++++++++++++++++++++++++++++++++++----------------
 libsvm.spec         | 69 +++++++++++++++++++++++++-------------------------
 2 files changed, 86 insertions(+), 56 deletions(-)
---
diff --git a/libsvm.spec b/libsvm.spec
index bb99bdb..f42b70e 100644
--- a/libsvm.spec
+++ b/libsvm.spec
@@ -13,12 +13,14 @@
 Summary:	LIBSVM - simple, easy-to-use and efficient software for SVM classification and regression
 Summary(pl.UTF-8):	LIBSVM - proste, łatwe w użyciu i wydajne oprogramowanie do klasyfikacji i regresji SVM
 Name:		libsvm
-Version:	3.24
-Release:	5
+# 3.3 is newer than 3.25, so call it 3.30
+%define	fver	3.3
+Version:	%{fver}0
+Release:	1
 License:	BSD
 Group:		Libraries
-Source0:	https://www.csie.ntu.edu.tw/~cjlin/libsvm/%{name}-%{version}.tar.gz
-# Source0-md5:	818aa0201dc9d938846a6394653915f4
+Source0:	https://www.csie.ntu.edu.tw/~cjlin/libsvm/%{name}-%{fver}.tar.gz
+# Source0-md5:	0803c429d061be3c6445d5a79b9ee7c7
 Patch0:		%{name}-python.patch
 Patch1:		%{name}-make.patch
 URL:		https://www.csie.ntu.edu.tw/~cjlin/libsvm/
@@ -26,10 +28,10 @@ URL:		https://www.csie.ntu.edu.tw/~cjlin/libsvm/
 BuildRequires:	libstdc++-devel
 %{?with_java:BuildRequires:	m4}
 %{?with_octave:BuildRequires:	octave-devel}
-%{?with_python2:BuildRequires:	python-devel >= 1:2.6}
-%{?with_python3:BuildRequires:	python3-devel >= 1:3.2}
+%{?with_python2:BuildRequires:	python-devel >= 1:2.7}
+%{?with_python3:BuildRequires:	python3-devel >= 1:3.5}
 BuildRequires:	rpm-pythonprov
-BuildRequires:	rpmbuild(macros) >= 1.507
+BuildRequires:	rpmbuild(macros) >= 1.714
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define		octave_oct_dir	%(octave-config --oct-site-dir)
@@ -89,7 +91,7 @@ Summary:	Python 2 interface for LIBSVM library
 Summary(pl.UTF-8):	Interfejs Pythona 2 do biblioteki LIBSVM
 Group:		Libraries/Python
 Requires:	%{name} = %{version}-%{release}
-Requires:	python-libs >= 1:2.6
+Requires:	python-libs >= 1:2.7
 
 %description -n python-libsvm
 Python 2 interface for LIBSVM library.
@@ -102,7 +104,7 @@ Summary:	Python 3 interface for LIBSVM library
 Summary(pl.UTF-8):	Interfejs Pythona 3 do biblioteki LIBSVM
 Group:		Libraries/Python
 Requires:	%{name} = %{version}-%{release}
-Requires:	python3-libs >= 1:3.2
+Requires:	python3-libs >= 1:3.5
 
 %description -n python3-libsvm
 Python 3 interface for LIBSVM library.
@@ -111,15 +113,10 @@ Python 3 interface for LIBSVM library.
 Interfejs Pythona 3 do biblioteki LIBSVM.
 
 %prep
-%setup -q
+%setup -q -n %{name}-%{fver}
 %patch0 -p1
 %patch1 -p1
 
-# probably it was meant to be shared between liblinear and libsvm interfaces,
-# but it's impossible to keep in sync at distro level between different
-# versions of both packages (see python patch for changes in sources)
-%{__mv} python/{commonutil,svmcommonutil}.py
-
 %build
 %{__make} \
 	CC="%{__cc}" \
@@ -140,6 +137,18 @@ Interfejs Pythona 3 do biblioteki LIBSVM.
 	MEX_EXT=mex
 %endif
 
+%if %{with python2}
+cd python
+%py_build
+cd ..
+%endif
+
+%if %{with python3}
+cd python
+%py3_build
+cd ..
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_bindir},%{_libdir},%{_includedir}}
@@ -159,18 +168,15 @@ install matlab/*.mex $RPM_BUILD_ROOT%{octave_oct_dir}/libsvm
 %endif
 
 %if %{with python2}
-install -d $RPM_BUILD_ROOT%{py_sitescriptdir}
-cp -p python/*.py $RPM_BUILD_ROOT%{py_sitescriptdir}
-%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
-%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
-%py_postclean
+cd python
+%py_install
+cd ..
 %endif
 
 %if %{with python3}
-install -d $RPM_BUILD_ROOT%{py3_sitescriptdir}
-cp -p python/*.py $RPM_BUILD_ROOT%{py3_sitescriptdir}
-%py3_comp $RPM_BUILD_ROOT%{py3_sitescriptdir}
-%py3_ocomp $RPM_BUILD_ROOT%{py3_sitescriptdir}
+cd python
+%py3_install
+cd ..
 %endif
 
 %clean
@@ -185,7 +191,7 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_bindir}/svm-predict
 %attr(755,root,root) %{_bindir}/svm-scale
 %attr(755,root,root) %{_bindir}/svm-train
-%attr(755,root,root) %{_libdir}/libsvm.so.2
+%attr(755,root,root) %{_libdir}/libsvm.so.3
 
 %files devel
 %defattr(644,root,root,755)
@@ -212,19 +218,14 @@ rm -rf $RPM_BUILD_ROOT
 %files -n python-libsvm
 %defattr(644,root,root,755)
 %doc python/README
-%{py_sitescriptdir}/svm.py[co]
-%{py_sitescriptdir}/svmcommonutil.py[co]
-%{py_sitescriptdir}/svmutil.py[co]
+%{py_sitescriptdir}/libsvm
+%{py_sitescriptdir}/libsvm_official-3.30.0-py*.egg-info
 %endif
 
 %if %{with python3}
 %files -n python3-libsvm
 %defattr(644,root,root,755)
 %doc python/README
-%{py3_sitescriptdir}/svm.py
-%{py3_sitescriptdir}/svmcommonutil.py
-%{py3_sitescriptdir}/svmutil.py
-%{py3_sitescriptdir}/__pycache__/svm.cpython-*.py[co]
-%{py3_sitescriptdir}/__pycache__/svmcommonutil.cpython-*.py[co]
-%{py3_sitescriptdir}/__pycache__/svmutil.cpython-*.py[co]
+%{py3_sitescriptdir}/libsvm
+%{py3_sitescriptdir}/libsvm_official-3.30.0-py*.egg-info
 %endif
diff --git a/libsvm-python.patch b/libsvm-python.patch
index c4aaf05..72df08f 100644
--- a/libsvm-python.patch
+++ b/libsvm-python.patch
@@ -1,33 +1,62 @@
---- libsvm-3.22/python/svm.py.orig	2016-12-21 19:58:55.000000000 +0100
-+++ libsvm-3.22/python/svm.py	2017-01-30 16:49:35.296237859 +0100
+--- libsvm-3.3/python/libsvm/commonutil.py.orig	2022-08-10 16:06:27.000000000 +0200
++++ libsvm-3.3/python/libsvm/commonutil.py	2023-01-18 06:28:48.186825376 +0100
+@@ -1,5 +1,3 @@
+-#!/usr/bin/env python
+-
+ from __future__ import print_function
+ from array import array
+ import sys
+--- libsvm-3.3/python/libsvm/svm.py.orig	2022-08-10 16:06:27.000000000 +0200
++++ libsvm-3.3/python/libsvm/svm.py	2023-01-18 06:29:05.290066053 +0100
 @@ -1,5 +1,3 @@
 -#!/usr/bin/env python
 -
  from ctypes import *
  from ctypes.util import find_library
  from os import path
---- libsvm-3.24/python/svmutil.py.orig	2019-12-25 13:55:36.752136723 +0100
-+++ libsvm-3.24/python/svmutil.py	2019-12-25 14:00:49.960439928 +0100
-@@ -1,12 +1,10 @@
+--- libsvm-3.3/python/libsvm/svmutil.py.orig	2022-08-10 16:06:27.000000000 +0200
++++ libsvm-3.3/python/libsvm/svmutil.py	2023-01-18 06:29:15.500010741 +0100
+@@ -1,5 +1,3 @@
 -#!/usr/bin/env python
 -
  import os, sys
- sys.path = [os.path.dirname(os.path.abspath(__file__))] + sys.path
- from svm import *
- from svm import __all__ as svm_all
- from svm import scipy, sparse
--from commonutil import *
--from commonutil import __all__ as common_all
-+from svmcommonutil import *
-+from svmcommonutil import __all__ as common_all
+ from .svm import *
+ from .svm import __all__ as svm_all
+--- libsvm-3.3/python/setup.py.orig	2022-08-10 16:06:27.000000000 +0200
++++ libsvm-3.3/python/setup.py	2023-01-18 06:33:05.588764243 +0100
+@@ -76,9 +76,6 @@ class CleanCommand(clean_cmd):
+                 rmtree(f)
  
- if sys.version_info[0] < 3:
- 	range = xrange
---- libsvm-3.24/python/commonutil.py.orig	2019-09-10 20:17:14.000000000 +0200
-+++ libsvm-3.24/python/commonutil.py	2019-12-25 14:06:38.408552223 +0100
-@@ -1,5 +1,3 @@
--#!/usr/bin/env python
+ def main():
+-    if not path.exists(cpp_dir):
+-        create_cpp_source()
 -
- from __future__ import print_function
- from array import array
- import sys
+     with open("README") as f:
+         long_description = f.read()
+ 
+@@ -93,11 +90,6 @@ def main():
+         author_email="cjlin at csie.ntu.edu.tw",
+         url="https://www.csie.ntu.edu.tw/~cjlin/libsvm",
+         install_requires=["scipy"],
+-        ext_modules=[
+-            Extension(
+-                "{}.{}".format(PACKAGE_DIR, dynamic_lib_name), **kwargs_for_extension
+-            )
+-        ],
+         cmdclass={"clean": CleanCommand},
+     )
+ 
+--- libsvm-3.3/python/libsvm/svm.py.orig	2023-01-18 06:29:47.973168152 +0100
++++ libsvm-3.3/python/libsvm/svm.py	2023-01-18 06:33:56.125157130 +0100
+@@ -23,10 +23,7 @@ __all__ = ['libsvm', 'svm_problem', 'svm
+            'SIGMOID', 'c_double', 'svm_model']
+ 
+ try:
+-    dirname = path.dirname(path.abspath(__file__))
+-    dynamic_lib_name = 'clib.cp*'
+-    path_to_so = glob(path.join(dirname, dynamic_lib_name))[0]
+-    libsvm = CDLL(path_to_so)
++    libsvm = CDLL("libsvm.so.3")
+ except:
+     try:
+         if sys.platform == 'win32':
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libsvm.git/commitdiff/b99baac4f3d052c1184103c0e35a4d7a5190658a



More information about the pld-cvs-commit mailing list