File python-hwdata.spec of Package python-hwdata.24170

#
# spec file for package python-hwdata
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%global __python /usr/bin/python2
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%if (0%{?fedora} || 0%{?rhel} > 7 || 0%{?suse_version} > 1320)
%global with_python3 1
%global py3dir %_builddir/py3/
%else
%global with_python3 0
%endif
%global with_test 0

%if 0%{?with_python3}
%define python python3
%else
%define python python
%endif

Name:           python-hwdata
Version:        2.3.5
Release:        1%{?dist}
Group:          Development/Languages/Python
Summary:        Python bindings to hwdata package
License:        GPL-2.0
BuildArch:      noarch
Url:            https://github.com/xsuchy/python-hwdata
# git clone https://github.com/xsuchy/python-hwdata.git
# cd python-hwdata
# tito build --tgz
Source0:        %{name}-%{version}.tar.gz

%if 0%{?rhel} >= 8
BuildRequires:  python2-devel
%else
BuildRequires:  python-devel < 3
%endif
BuildRequires:  %{python}-rpm-macros

%description
Provide python interface to database stored in hwdata package.
It allows you to get human readable description of USB and PCI devices.

%package -n python2-hwdata
Summary:        Python bindings to hwdata package
Requires:       hwdata
Provides:       python-hwdata = %{version}-%{release}
Obsoletes:      python-hwdata < %{version}-%{release}

%description -n python2-hwdata
Provide python interface to database stored in hwdata package.
It allows you to get human readable description of USB and PCI devices.

This is the Python 2 build of the module.

%if 0%{?with_python3}
%package -n python3-hwdata
Summary:        Python bindings to hwdata package

%if 0%{?with_test}
BuildRequires:  python3-pylint
%endif
BuildRequires:  python3-devel
Requires:       hwdata

%description -n python3-hwdata
Provide python interface to database stored in hwdata package.
It allows you to get human readable description of USB and PCI devices.

This is the Python 3 build of the module.
%endif

%prep
%setup -q

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%{__python} setup.py build

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

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

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --prefix=%{_prefix} --root=%{buildroot}
popd
%endif



%check
%if 0%{?with_test}
pylint-3 hwdata.py example.py || :
%endif

%files -n python2-hwdata
%defattr(-,root,root)
%doc LICENSE
%doc README.md example.py
%doc html
%{python_sitelib}/*

%if 0%{?with_python3}
%files -n python3-hwdata
%defattr(-,root,root)
%doc LICENSE
%doc README.md example.py
%doc html
%{python3_sitelib}/*
%endif

%changelog
openSUSE Build Service is sponsored by