use python3 replace python2

This commit is contained in:
jinzhimin369 2020-10-29 15:11:12 +08:00
parent 15b50549fa
commit 23625cb88e

View File

@ -1,30 +1,20 @@
%bcond_with tests %bcond_with tests
Name: python-ethtool Name: python-ethtool
Version: 0.14 Version: 0.14
Release: 3 Release: 4
Summary: Python bindings for the ethtool kernel interface Summary: Python bindings for the ethtool kernel interface
License: GPLv2 License: GPLv2
URL: https://pypi.org/project/ethtool/ URL: https://pypi.org/project/ethtool/
Source0: https://files.pythonhosted.org/packages/81/41/e6cb9026374771e3bdb4c0fe8ac0c51c693a14b4f72f26275da15f7a4d8b/ethtool-%{version}.tar.gz Source0: https://files.pythonhosted.org/packages/81/41/e6cb9026374771e3bdb4c0fe8ac0c51c693a14b4f72f26275da15f7a4d8b/ethtool-%{version}.tar.gz
BuildRequires: python2-devel python3-devel python2-setuptools BuildRequires: gcc libnl3-devel python3-setuptools python3-devel
BuildRequires: gcc libnl3-devel python3-setuptools
%description %description
Python bindings for the ethtool kernel interface. The Python ethtool Python bindings for the ethtool kernel interface. The Python ethtool
module allows querying and partially controlling network interfaces, module allows querying and partially controlling network interfaces,
driver, and hardware settings. driver, and hardware settings.
%package -n python2-ethtool
Summary: Python 2 bindings for the ethtool kernel interface
%{?python_provide:%python_provide python2-ethtool}
%description -n python2-ethtool
Python 2 bindings for the ethtool kernel interface. The Python ethtool
module allows querying and partially controlling network interfaces,
driver, and hardware settings.
%package -n python3-ethtool %package -n python3-ethtool
Summary: Python 3 bindings for the ethtool kernel interface Summary: Python 3 bindings for the ethtool kernel interface
%{?python_provide:%python_provide python3-ethtool} %{?python_provide:%python_provide python3-ethtool}
@ -40,25 +30,14 @@ driver, and hardware settings.
%autosetup -n ethtool-%{version} -p1 %autosetup -n ethtool-%{version} -p1
rm -rf ethtool.egg-info rm -rf ethtool.egg-info
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|'
%build %build
%py2_build
pushd %{py3dir}
%py3_build %py3_build
popd
%install %install
%py2_install
pushd %{py3dir}
%py3_install %py3_install
install -d %{buildroot}%{_sbindir} install -d %{buildroot}%{_sbindir}
mv %{buildroot}%{_bindir}/pethtool %{buildroot}%{_sbindir} mv %{buildroot}%{_bindir}/pethtool %{buildroot}%{_sbindir}
mv %{buildroot}%{_bindir}/pifconfig %{buildroot}%{_sbindir} mv %{buildroot}%{_bindir}/pifconfig %{buildroot}%{_sbindir}
popd
install -d %{buildroot}%{_mandir}/man8/ install -d %{buildroot}%{_mandir}/man8/
install -p man/*.8.* %{buildroot}%{_mandir}/man8/ install -p man/*.8.* %{buildroot}%{_mandir}/man8/
@ -66,23 +45,11 @@ rm -rf tests/test_scripts.py
%if %{with tests} %if %{with tests}
%check %check
export PYTHONPATH=%{buildroot}%{python2_sitearch}
%{__python2} tests/parse_ifconfig.py -v
%{__python2} -m unittest discover -v
pushd %{py3dir}
export PYTHONPATH=%{buildroot}%{python3_sitearch} export PYTHONPATH=%{buildroot}%{python3_sitearch}
%{__python3} tests/parse_ifconfig.py -v %{__python3} tests/parse_ifconfig.py -v
%{__python3} -m unittest discover -v %{__python3} -m unittest discover -v
popd
%endif %endif
%files -n python2-ethtool
%doc README.rst
%license COPYING
%{python2_sitearch}/ethtool.so
%{python2_sitearch}/ethtool-0.14-py?.?.egg-info
%files -n python3-ethtool %files -n python3-ethtool
%doc README.rst %doc README.rst
%license COPYING %license COPYING
@ -96,6 +63,9 @@ popd
%doc %{_mandir}/man* %doc %{_mandir}/man*
%changelog %changelog
* Thu Oct 29 2020 wangye <wangye70@huawei.com> - 0.14-4
- remove python2-ethtool subpackage and delete python2 for build
* Thu Jun 18 2020 jinzhimin <jinzhimin2@huawei.com> - 0.14-3 * Thu Jun 18 2020 jinzhimin <jinzhimin2@huawei.com> - 0.14-3
- Type:bugfix - Type:bugfix
- Id:NA - Id:NA