[packages/libsvm] - updated to 3.24 - updated python patch - rename commonutil python module to svmcommonutil to avoid
qboosh
qboosh at pld-linux.org
Wed Dec 25 18:57:50 CET 2019
commit 467e284ff6f80d6707a473edeb432bc7bc69ef53
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Wed Dec 25 18:58:36 2019 +0100
- updated to 3.24
- updated python patch
- rename commonutil python module to svmcommonutil to avoid conflict with liblinear
- added python3- package
libsvm-python.patch | 25 +++++++++++++---
libsvm.spec | 85 +++++++++++++++++++++++++++++++++++++++++++++--------
2 files changed, 93 insertions(+), 17 deletions(-)
---
diff --git a/libsvm.spec b/libsvm.spec
index 398a57f..554b232 100644
--- a/libsvm.spec
+++ b/libsvm.spec
@@ -2,24 +2,34 @@
# Conditional build:
%bcond_without java # Java library
%bcond_without octave # Octave (MATLAB) module
+%bcond_without python # Python (any) interface
+%bcond_without python2 # Python 2.x interface
+%bcond_without python3 # Python 3.x interface
#
+%if %{without python}
+%undefine with_python2
+%undefine with_python3
+%endif
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.22
-Release: 2
+Version: 3.24
+Release: 1
License: BSD
Group: Libraries
-Source0: http://www.csie.ntu.edu.tw/~cjlin/libsvm/%{name}-%{version}.tar.gz
-# Source0-md5: 7c5c521a6a68c0f879c82f376e3557b6
+Source0: https://www.csie.ntu.edu.tw/~cjlin/libsvm/%{name}-%{version}.tar.gz
+# Source0-md5: 818aa0201dc9d938846a6394653915f4
Patch0: %{name}-python.patch
Patch1: %{name}-make.patch
-URL: http://www.csie.ntu.edu.tw/~cjlin/libsvm/
+URL: https://www.csie.ntu.edu.tw/~cjlin/libsvm/
%{?with_java:BuildRequires: jdk >= 1.7}
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}
BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.507
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define octave_oct_dir %(octave-config --oct-site-dir)
@@ -75,22 +85,41 @@ MATLAB/Octave interface for LIBSVM library.
Interfejs MATLAB-a/Octave do biblioteki LIBSVM.
%package -n python-libsvm
-Summary: Python interface for LIBSVM library
-Summary(pl.UTF-8): Interfejs Pythona do biblioteki LIBSVM
+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
%description -n python-libsvm
-Python interface for LIBSVM library.
+Python 2 interface for LIBSVM library.
%description -n python-libsvm -l pl.UTF-8
-Interfejs Pythona do biblioteki LIBSVM.
+Interfejs Pythona 2 do biblioteki LIBSVM.
+
+%package -n python3-libsvm
+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
+
+%description -n python3-libsvm
+Python 3 interface for LIBSVM library.
+
+%description -n python3-libsvm -l pl.UTF-8
+Interfejs Pythona 3 do biblioteki LIBSVM.
%prep
%setup -q
%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}" \
@@ -113,13 +142,12 @@ Interfejs Pythona do biblioteki LIBSVM.
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_bindir},%{_libdir},%{_includedir},%{py_sitescriptdir}}
+install -d $RPM_BUILD_ROOT{%{_bindir},%{_libdir},%{_includedir}}
install libsvm.so.* $RPM_BUILD_ROOT%{_libdir}
ln -sf $(basename $RPM_BUILD_ROOT%{_libdir}/libsvm.so.*) $RPM_BUILD_ROOT%{_libdir}/libsvm.so
cp -p svm.h $RPM_BUILD_ROOT%{_includedir}
install svm-predict svm-scale svm-train $RPM_BUILD_ROOT%{_bindir}
-cp -p python/*.py $RPM_BUILD_ROOT%{py_sitescriptdir}
%if %{with java}
install -D java/libsvm.jar $RPM_BUILD_ROOT%{_javadir}/libsvm.jar
@@ -130,6 +158,21 @@ install -d $RPM_BUILD_ROOT%{octave_oct_dir}/libsvm
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
+%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}
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
@@ -165,7 +208,23 @@ rm -rf $RPM_BUILD_ROOT
%attr(755,root,root) %{octave_oct_dir}/libsvm/svmtrain.mex
%endif
+%if %{with python2}
%files -n python-libsvm
%defattr(644,root,root,755)
-%{py_sitescriptdir}/svm.py
-%{py_sitescriptdir}/svmutil.py
+%doc python/README
+%{py_sitescriptdir}/svm.py[co]
+%{py_sitescriptdir}/svmcommonutil.py[co]
+%{py_sitescriptdir}/svmutil.py[co]
+%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]
+%endif
diff --git a/libsvm-python.patch b/libsvm-python.patch
index 96231db..c4aaf05 100644
--- a/libsvm-python.patch
+++ b/libsvm-python.patch
@@ -6,11 +6,28 @@
from ctypes import *
from ctypes.util import find_library
from os import path
---- libsvm-3.22/python/svmutil.py.orig 2016-12-21 19:58:55.000000000 +0100
-+++ libsvm-3.22/python/svmutil.py 2017-01-30 16:49:41.606237787 +0100
+--- 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 @@
+-#!/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
+
+ 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
-
- import os
+ from __future__ import print_function
+ from array import array
import sys
- from svm import *
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/libsvm.git/commitdiff/467e284ff6f80d6707a473edeb432bc7bc69ef53
More information about the pld-cvs-commit
mailing list