File python-ethtool.spec of Package python-ethtool

%define realname python-ethtool
%define srcext   tar.bz2

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

%if ! 0%{?py_ver:1}
%define py_ver %(python -c "import sys; v=sys.version_info[:2]; print('%%d.%%d'%%v)" 2>/dev/null || echo PYTHON-NOT-FOUND)
%endif

# Common info
Name:          python-ethtool
Version:       0.13
Release:       wiz%{?extraver:0.}1%{?dist}
License:       GPL-2.0
Group:         Development/Libraries/Python
URL:           https://github.com/fedora-python/python-ethtool
Summary:       Python module to interface with ethtool

# Install-time parameters
Requires:      python(abi) = %{py_ver}

# Build-time parameters
BuildRequires: pkgconfig
BuildRequires: python-devel
BuildRequires: pkgconfig(libnl-3.0)
BuildRequires: python-setuptools
BuildRoot:     %{_tmppath}/%{name}-root
Source:        %{realname}-%{version}%{?extraver}.%{srcext}

%description
Python bindings for the ethtool kernel interface

The Python ethtool module allows querying and changing of ethernet card
settings, such as speed, port, autonegotiation, and PCI locations.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot} -O2

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc COPYING README.rst
%{_bindir}/*
%{python_sitearch}/*

%changelog