Remove Python 2 subpackage (#1655696)

epel8
Miro Hrončok 6 years ago
parent 39907b427f
commit 5d6382851e

@ -1,10 +1,5 @@
%define shver 2 %define shver 2
# EL7 and EL6 only have python_version
%{!?python2_version: %global python2_version %{python_version}}
%{!?python2_sitearch: %global python2_sitearch %{python_sitearch}}
%{!?python2_sitelib: %global python2_sitearch %{python_sitelib}}
%global libdir_libsvm %{_libdir}/libsvm %global libdir_libsvm %{_libdir}/libsvm
%global python2_libsvm_dir %{python2_sitearch}/libsvm
%global python3_libsvm_dir %{python3_sitearch}/libsvm %global python3_libsvm_dir %{python3_sitearch}/libsvm
%global maven_group_id tw.edu.ntu.csie %global maven_group_id tw.edu.ntu.csie
%global pom_file_version 3.17 %global pom_file_version 3.17
@ -26,19 +21,10 @@
%global cpp_std c++11 %global cpp_std c++11
%endif %endif
# EL <= 7 python 3 is not available by default
%if 0%{?rhel} != 0 && 0%{?rhel} <= 7
%global python2_package_name libsvm-python
%bcond_with python3
%else
%global python2_package_name python2-libsvm
%bcond_without python3
%endif
Name: libsvm Name: libsvm
Version: 3.23 Version: 3.23
Release: 3%{?dist} Release: 4%{?dist}
Summary: A Library for Support Vector Machines Summary: A Library for Support Vector Machines
Group: Development/Libraries Group: Development/Libraries
@ -71,24 +57,6 @@ Requires: %{name} = %{version}-%{release}
Header file, object file of libsvm in C, C++ and Java. Header file, object file of libsvm in C, C++ and Java.
Install this package if you want to develop programs with libsvm. Install this package if you want to develop programs with libsvm.
%package -n %{python2_package_name}
%{?python_provide:%python_provide python2-libsvm}
Provides: %{name}-python%{?_isa} = %{version}-%{release}
Provides: %{name}-python = %{version}-%{release}
Obsoletes: %{name}-python%{?_isa} < %{version}-%{release}
Summary: Python2 tools and interfaces for libsvm
Group: Development/Libraries
BuildRequires: python2-devel >= 2.4 gawk
#gnuplot is required by easy.py
Requires: %{name} = %{version}-%{release}
Requires: gnuplot
%description -n %{python2_package_name}
Python2 tools and interfaces for libsvm.
Install this package if you want to develop
programs with libsvm in Python2.
%if %{with python3}
%package -n python3-%{name} %package -n python3-%{name}
%{?python_provide:%python_provide python3-%{name}} %{?python_provide:%python_provide python3-%{name}}
Summary: Python3 tools and interfaces for libsvm Summary: Python3 tools and interfaces for libsvm
@ -102,7 +70,6 @@ Requires: gnuplot
Python3 tools and interfaces for libsvm. Python3 tools and interfaces for libsvm.
Install this package if you want to develop Install this package if you want to develop
programs with libsvm in Python3. programs with libsvm in Python3.
%endif
%if %{with java} %if %{with java}
%package java %package java
@ -206,35 +173,10 @@ cp %{name}-svm-toy-qt.desktop %{buildroot}/%{_datadir}/applications
%__ln_s %{name}.so.%{shver} %{buildroot}/%{_libdir}/%{name}.so %__ln_s %{name}.so.%{shver} %{buildroot}/%{_libdir}/%{name}.so
## Python2
# [Bug 521194] Python: 'import libsvm' doesn't work
mkdir -p %{buildroot}/%{python2_libsvm_dir}
echo -e "# This file is not in the original libsvm tarball, but added for convenience of import libsvm.\n\
# This file is released under BSD license, just like the rest of the package.\n"\
> %{buildroot}/%{python2_libsvm_dir}/__init__.py
install -p -m 755 tools/*.py %{buildroot}/%{python2_libsvm_dir}
install -p -m 755 python/*.py %{buildroot}/%{python2_libsvm_dir}
# Fix Bug 646154 - libsvm-python's pth is not set correctly
echo 'libsvm' > %{buildroot}/%{python2_sitearch}/libsvm.pth
for p in %{buildroot}%{python2_libsvm_dir}/*.py;do
sed -i -e 's|#!/usr/bin/env python|#!%{__python2}|' $p
done
%if ! %{with python3}
## Use python2 when python3 is not enabled.
cd tools
for p in *.py; do
ln -s %{python2_libsvm_dir}/$p %{buildroot}/%{_bindir}/svm-$p
done
cd -
%endif
## Python3
%if %{with python3}
mkdir -p %{buildroot}/%{python3_libsvm_dir} mkdir -p %{buildroot}/%{python3_libsvm_dir}
echo -e "# This file is not in the original libsvm tarball, but added for convenience of import libsvm.\n\ echo -e "# This file is not in the original libsvm tarball, but added for convenience of import libsvm.\n\
# This file is released under BSD license, just like the rest of the package.\n"\ # This file is released under BSD license, just like the rest of the package.\n"\
> %{buildroot}/%{python2_libsvm_dir}/__init__.py > %{buildroot}/%{python3_libsvm_dir}/__init__.py
install -p -m 755 tools/*.py %{buildroot}/%{python3_libsvm_dir} install -p -m 755 tools/*.py %{buildroot}/%{python3_libsvm_dir}
install -p -m 755 python/*.py %{buildroot}/%{python3_libsvm_dir} install -p -m 755 python/*.py %{buildroot}/%{python3_libsvm_dir}
echo 'libsvm' > %{buildroot}/%{python3_sitearch}/libsvm.pth echo 'libsvm' > %{buildroot}/%{python3_sitearch}/libsvm.pth
@ -246,7 +188,6 @@ for p in *.py; do
ln -s %{python3_libsvm_dir}/$p %{buildroot}/%{_bindir}/svm-$p ln -s %{python3_libsvm_dir}/$p %{buildroot}/%{_bindir}/svm-$p
done done
cd - cd -
%endif
# Java # Java
%if %{with java} %if %{with java}
@ -283,21 +224,11 @@ desktop-file-install --delete-original \
%{_includedir}/%{name}/ %{_includedir}/%{name}/
%{_libdir}/%{name}.so %{_libdir}/%{name}.so
%files -n %{python2_package_name}
%doc python/README-Python tools/README-Tools
%{python2_libsvm_dir}
%if ! %{with python3}
%{_bindir}/svm-*.py
%endif
%{python2_sitearch}/libsvm.pth
%if %{with python3}
%files -n python3-%{name} %files -n python3-%{name}
%doc python/README-Python tools/README-Tools %doc python/README-Python tools/README-Tools
%{python3_libsvm_dir} %{python3_libsvm_dir}
%{_bindir}/svm-*.py %{_bindir}/svm-*.py
%{python3_sitearch}/libsvm.pth %{python3_sitearch}/libsvm.pth
%endif
%if %{with java} %if %{with java}
%if %{with maven} %if %{with maven}
@ -322,6 +253,9 @@ desktop-file-install --delete-original \
%{_datadir}/applications/*%{name}-svm-toy-qt.desktop %{_datadir}/applications/*%{name}-svm-toy-qt.desktop
%changelog %changelog
* Tue Jan 15 2019 Miro Hrončok <mhroncok@redhat.com> - 3.23-4
- Remove Python 2 subpackage (#1655696)
* Tue Aug 28 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.23-3 * Tue Aug 28 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.23-3
- Fix Provides/Obsoletes for old python subpackage - Fix Provides/Obsoletes for old python subpackage

Loading…
Cancel
Save