Updated to 0.13, added python3 and python2 subpackages

This commit is contained in:
Miro Hrončok 2017-06-13 18:14:22 +02:00
parent 0941d2ace0
commit 80173a999f
4 changed files with 92 additions and 57 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ python-ethtool-0.5.tar.bz2
/python-ethtool-0.9.tar.bz2
/python-ethtool-0.10.tar.bz2
/python-ethtool-0.11.tar.bz2
/ethtool-0.13.tar.gz

View File

@ -1,24 +0,0 @@
From a43f582918d3295b7cdef9e056bf5b1c4eb2ef80 Mon Sep 17 00:00:00 2001
From: Yaakov Selkowitz <yselkowi@redhat.com>
Date: Mon, 22 Jun 2015 05:18:44 -0500
Subject: [PATCH] Include net/if.h for IFF_* macros
---
python-ethtool/ethtool.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/python-ethtool/ethtool.c b/python-ethtool/ethtool.c
index 0f9cdbb..5415ec6 100644
--- a/python-ethtool/ethtool.c
+++ b/python-ethtool/ethtool.c
@@ -27,6 +27,7 @@
#include <sys/types.h>
#include <ifaddrs.h>
#include <netlink/route/addr.h>
+#include <net/if.h>
#include "etherinfo_struct.h"
#include "etherinfo_obj.h"
--
2.1.0

View File

@ -1,57 +1,115 @@
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%{!?python_ver: %define python_ver %(%{__python} -c "import sys ; print sys.version[:3]")}
# The tests fail in mock
%bcond_with tests
Summary: Ethernet settings python bindings
Name: python-ethtool
Version: 0.11
Release: 8%{?dist}
URL: https://fedorahosted.org/python-ethtool/
Source: https://fedorahosted.org/releases/p/y/python-ethtool/python-ethtool-%{version}.tar.bz2
License: GPLv2
Group: System Environment/Libraries
BuildRequires: python-devel libnl3-devel asciidoc
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# Created by pyp2rpm-3.2.2
%global pypi_name ethtool
Patch1: 0001-Include-net-if.h-for-IFF_-macros.patch
Name: python-%{pypi_name}
Version: 0.13
Release: 1%{?dist}
Summary: Python module to interface with %{pypi_name}
License: GPLv2
URL: https://github.com/fedora-python/%{name}
Source0: https://files.pythonhosted.org/packages/source/e/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: libnl3-devel
BuildRequires: asciidoc
%description
Python bindings for the ethtool kernel interface, that allows querying and
changing of Ethernet card settings, such as speed, port, auto-negotiation, and
PCI locations.
%package -n python2-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{pypi_name}}
%description -n python2-%{pypi_name}
Python 2 bindings for the ethtool kernel interface, that allows querying and
changing of Ethernet card settings, such as speed, port, auto-negotiation, and
PCI locations.
%package -n python3-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name}
Python 3 bindings for the ethtool kernel interface, that allows querying and
changing of Ethernet card settings, such as speed, port, auto-negotiation, and
PCI locations.
%prep
%setup -q
%patch1 -p1
%autosetup -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
%build
%{__python} setup.py build
%py2_build
%py3_build
a2x -d manpage -f manpage man/pethtool.8.asciidoc
a2x -d manpage -f manpage man/pifconfig.8.asciidoc
%install
rm -rf %{buildroot}
%{__python} setup.py install --skip-build --root %{buildroot}
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_mandir}/man8
cp -p pethtool.py %{buildroot}%{_sbindir}/pethtool
cp -p pifconfig.py %{buildroot}%{_sbindir}/pifconfig
%py2_install
rm %{buildroot}%{_bindir}/pifconfig
rm %{buildroot}%{_bindir}/pethtool
%py3_install
mkdir -p %{buildroot}%{_sbindir}
mv %{buildroot}{%{_bindir},%{_sbindir}}/pifconfig
mv %{buildroot}{%{_bindir},%{_sbindir}}/pethtool
mkdir -p %{buildroot}%{_mandir}/man8/
%{__gzip} -c man/pethtool.8 > %{buildroot}%{_mandir}/man8/pethtool.8.gz
%{__gzip} -c man/pifconfig.8 > %{buildroot}%{_mandir}/man8/pifconfig.8.gz
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%doc COPYING
%{_sbindir}/pethtool
%{_sbindir}/pifconfig
%doc %{_mandir}/man8/*
%{python_sitearch}/ethtool.so
%if "%{python_ver}" >= "2.5"
%{python_sitearch}/*.egg-info
%if %{with tests}
%check
export PYTHONPATH=%{buildroot}%{python2_sitearch}
%{__python2} tests/parse_ifconfig.py -v
%{__python2} -m unittest discover -v
export PYTHONPATH=%{buildroot}%{python3_sitearch}
%{__python3} tests/parse_ifconfig.py -v
%{__python3} -m unittest discover -v
%endif
%files -n python2-%{pypi_name}
%doc README.rst CHANGES.rst
%license COPYING
%{python2_sitearch}/%{pypi_name}.so
%{python2_sitearch}/%{pypi_name}-%{version}-py?.?.egg-info
%files -n python3-%{pypi_name}
%doc README.rst CHANGES.rst
%license COPYING
%{_sbindir}/pifconfig
%{_sbindir}/pethtool
%doc %{_mandir}/man8/*
%{python3_sitearch}/%{pypi_name}.cpython-%{python3_version_nodots}*.so
%{python3_sitearch}/%{pypi_name}-%{version}-py?.?.egg-info
%changelog
* Tue Jun 13 2017 Miro Hrončok <mhroncok@redhat.com> - 0.13-1
- Updated to 0.13
- Added python3 and python2 subpackages
- Add --with tests
- Modernize spec
- Remove merged patch
- Update upstream URL
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.11-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

View File

@ -1 +1 @@
b505501d928debf69664b72fafa9d0c3 python-ethtool-0.11.tar.bz2
SHA512 (ethtool-0.13.tar.gz) = da2be2d9c4404fc322807128090b483746199ed0def12df4b5a7e9f4fee380a32727d0e43a770e34f0d99fec7d68310ee104deafc92caff262622f623184c118