Blob Blame History Raw
%{?!_licensedir:%global license %%doc}
%{!?upstream_version: %global upstream_version %{version}}

%if 0%{?fedora}
%global with_python3 1
%endif

Name:           python-hardware
Summary:        Hardware detection and classification utilities
Version:        0.18
Release:        12%{?dist}
License:        ASL 2.0
URL:            https://pypi.python.org/pypi/hardware

Source0:        https://pypi.io/packages/source/h/hardware/hardware-%{upstream_version}.tar.gz

BuildArch:      noarch
BuildRequires:  python2-setuptools
BuildRequires:  python2-devel
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-pbr
BuildRequires:  python3-six
BuildRequires:  python3-netaddr
%endif # if with_python3
BuildRequires:  python2-pbr
BuildRequires:  python2-six
BuildRequires:  python2-sphinx
BuildRequires:  python2-oslo-sphinx
BuildRequires:  git
# unit tests
BuildRequires:  python2-netaddr
BuildRequires:  python2-nose
BuildRequires:  python2-numpy
BuildRequires:  python2-pexpect
BuildRequires:  python2-pandas


%prep
%autosetup -S git -n hardware-%{upstream_version}
rm -rf *.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3

find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'

%build
%{__python2} setup.py build
%{__python2} setup.py build_sphinx
rm -rf doc/build/html/.buildinfo

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
%endif # with_python3

%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3

%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}

%check
nosetests-2 hardware/tests

%global _description\
Hardware detection and classification utilities.\
Features:\
* detect hardware features of a Linux systems:\
** RAID\
** hard drives\
** IPMI\
** network cards\
** DMI info\
** memory settings\
** processor features\
* filter hardware according to hardware profiles

%description %_description

%package -n python2-hardware
Summary: %summary
Requires: python2-numpy
Requires: python2-hardware-detect = %{version}-%{release}
Requires: python2-babel
Requires: python2-pandas
Requires: python2-pbr
Requires: python2-six
%{?python_provide:%python_provide python2-hardware}

%description -n python2-hardware %_description

%if 0%{?with_python3}
%package -n python3-hardware
Summary:        Hardware detection and classification utilities
Group:          Development/Languages
Requires: python3-numpy
Requires: python3-pbr
Requires: python3-babel
Requires: python3-netaddr
Requires: python3-pexpect
Requires: python3-six
%{?python_provide:%python_provide python3-hardware}

%description -n python3-hardware %_description
%endif # with_python3

%package -n python2-hardware-detect
Summary:    Hardware detection and classification utilities
Requires: lshw
Requires: smartmontools
Requires: lldpad
Requires: sdparm
Requires: sysbench
Requires: fio
Requires: python2-pbr
Requires: python2-ipaddr
Requires: python2-netaddr
%if 0%{?fedora}
Requires: python2-pexpect
%else
Requires: pexpect
%endif
Requires: python2-ptyprocess
Requires: ethtool
Requires: pciutils
%{?python_provide:%python_provide python2-hardware-detect}

%description -n python2-hardware-detect
Hardware detection and classification utilities.


%package doc
Summary:    Documentation for Hardware detection and classification utilities
Group:      Documentation

%description doc
Documentation for Hardware detection and classification utilities.


%files -n python2-hardware
%license LICENSE
%doc README.rst
%{python2_sitelib}/hardware/cardiff
%{_bindir}/hardware-cardiff
%{python2_sitelib}/hardware/test*

%files -n python2-hardware-detect
%license LICENSE
%doc README.rst
%{_bindir}/hardware-detect
%{python2_sitelib}/hardware/benchmark
%{python2_sitelib}/hardware/*.py*
%{python2_sitelib}/hardware*.egg-info

%files doc
%license LICENSE
%doc doc/build/html

%if 0%{?with_python3}
%files -n python3-hardware
%license LICENSE
%doc README.rst
%{python3_sitelib}/hardware*
%exclude %{python3_sitelib}/hardware/test*
%endif # with_python3

%changelog
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.18-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.18-11
- Rebuilt for Python 3.7

* Tue Mar 20 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.18-10
- Also rename python-hardware-detect to python2-hardware-detect
- Add missing %%python_provide calls
- Use new python2-* names for dependencies

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.18-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Aug 30 2017 Frederic Lepied <frederic.lepied@redhat.com> - 0.18-8
- run unit tests at build time

* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.18-7
- Python 2 binary package renamed to python2-hardware
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.18-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Tue Jun 13 2017 Haïkel Guémar <hguemar@fedoraproject.org> - 0.18-5
- Refresh spec file

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.18-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Thu Dec 22 2016 Miro Hrončok <mhroncok@redhat.com> - 0.18-3
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.18-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Tue Jul  5 2016 Frederic Lepied <frederic.lepied@redhat.com> 0.18-1
- new version (bug #1196176)
- add missing deps on python(3)-pbr (rhbz#1346054, Thierry Vignaud)

* Thu Feb 11 2016 Frederic Lepied <frederic.lepied@redhat.com> 0.17-6
- split the detect part in a standalone package python-hardware-detect
- fix the missing requires: ethtool and pcitutils

* Wed Feb 10 2016 Frederic Lepied <frederic.lepied@redhat.com> 0.17-5
- exclude examples

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.17-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.17-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Wed Oct 14 2015 Frederic Lepied <frederic.lepied@redhat.com> 0.17-2
- add missing requires: lshw, smartmontools, lldpad, sdparm (Erwan)
- add missing requires: fio (taken from Delorean)

* Wed Sep 23 2015 Frederic Lepied <frederic.lepied@redhat.com> 0.17-1
- new version (bug #1196176)

* Sat Aug  8 2015 Frederic Lepied <frederic.lepied@redhat.com> 0.16-1
- new version (bug #1196176)

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.15-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Mon May 11 2015 Frederic Lepied <frederic.lepied@redhat.com> - 0.15-1
- new version (bug #1196176)

* Tue May 05 2015 Haïkel Guémar <hguemar@fedoraproject> - 0.14-2
- Fix requirements
- Add a patch to improve output of cardiff from John Trowbridge

* Tue Mar 31 2015 Frederic Lepied <frederic.lepied@redhat.com> - 0.14-1
- new version (bug #1196176)

* Thu Mar 26 2015 Frederic Lepied <frederic.lepied@redhat.com> - 0.13-1
- new version (bug #1196176)

* Wed Mar 18 2015 Frederic Lepied <frederic.lepied@redhat.com> - 0.12-1
- new version (bug #1196176)

* Tue Feb 24 2015 Dmitry Tantsur <divius.inside@gmail.com> - 0.11-1
- new version (bug #1195701)

* Fri Feb 13 2015 Dmitry Tantsur <dtantsur@redhat.com> - 0.9-1
- Initial package build