79f9dc
%{?python_enable_dependency_generator}
79f9dc
%global sname pyghmi
79f9dc
%global common_summary Python General Hardware Management Initiative (IPMI and others)
79f9dc
79f9dc
%global common_desc This is a pure Python implementation of IPMI protocol. \
79f9dc
\
79f9dc
The included pyghmicons and pyghmiutil scripts demonstrate how one may \
79f9dc
incorporate the pyghmi library into a Python application.
79f9dc
79f9dc
%global common_desc_tests Tests for the pyghmi library
79f9dc
79f9dc
# Enable python3 build in fedora and rhel>7 and python2 only for rhel=7
79f9dc
%if 0%{?fedora} || 0%{?rhel} > 7
79f9dc
%global with_python3 1
79f9dc
%global with_python2 0
79f9dc
%else
79f9dc
%global with_python3 0
79f9dc
%global with_python2 1
79f9dc
%endif
79f9dc
79f9dc
%if %{lua: if (string.find(rpm.expand("%{?dist}"), "ost") == nil) then print(0) else print(1) end}
79f9dc
%bcond_without              docs
79f9dc
%else
79f9dc
%bcond_with                 docs
79f9dc
%endif
79f9dc
79f9dc
Summary: %{common_summary}
79f9dc
Name: python-%{sname}
79f9dc
Version: %{?version:%{version}}%{!?version:1.5.34}
79f9dc
Release: 2%{?dist}
79f9dc
Source0: https://tarballs.opendev.org/x/%{sname}/%{sname}-%{version}.tar.gz
79f9dc
License: ASL 2.0
79f9dc
Prefix: %{_prefix}
79f9dc
BuildArch: noarch
79f9dc
Url: https://git.openstack.org/cgit/openstack/pyghmi
79f9dc
79f9dc
Patch0:  nopbr.patch
79f9dc
Patch1:  setup.patch
79f9dc
79f9dc
%description
79f9dc
%{common_desc}
79f9dc
79f9dc
%if 0%{?with_python2}
79f9dc
%package -n python2-%{sname}
79f9dc
Summary: %{common_summary}
79f9dc
%{?python_provide:%python_provide python2-%{sname}}
79f9dc
79f9dc
BuildRequires: openstack-macros
79f9dc
BuildRequires: python2-devel
79f9dc
#BuildRequires: python2-pbr
79f9dc
BuildRequires: python2-setuptools
79f9dc
79f9dc
Requires: python2-cryptography >= 2.1
79f9dc
Requires: python2-six >= 1.10.0
79f9dc
Requires: python2-dateutil >= 2.6.1
79f9dc
79f9dc
%description -n python2-%{sname}
79f9dc
%{common_desc}
79f9dc
79f9dc
%package -n python2-%{sname}-tests
79f9dc
Summary: %{common_desc_tests}
79f9dc
Requires: python2-%{sname} = %{version}-%{release}
79f9dc
79f9dc
%description -n python2-%{sname}-tests
79f9dc
%{common_desc_tests}
79f9dc
79f9dc
%endif # with_python2
79f9dc
79f9dc
%if 0%{?with_python3}
79f9dc
79f9dc
%package -n python3-%{sname}
79f9dc
Summary: %{common_summary}
79f9dc
%{?python_provide:%python_provide python3-%{sname}}
79f9dc
79f9dc
BuildRequires: python3-devel
79f9dc
#BuildRequires: python3-pbr
79f9dc
BuildRequires: python3-setuptools
79f9dc
79f9dc
Requires: python3-cryptography >= 2.1
79f9dc
Requires: python3-six >= 1.10.0
79f9dc
Requires: python3-dateutil >= 2.6.1
79f9dc
79f9dc
%description -n python3-%{sname}
79f9dc
%{common_desc}
79f9dc
79f9dc
%package -n python3-%{sname}-tests
79f9dc
Summary: %{common_desc_tests}
79f9dc
Requires: python3-%{sname} = %{version}-%{release}
79f9dc
79f9dc
%description -n python3-%{sname}-tests
79f9dc
%{common_desc_tests}
79f9dc
79f9dc
%endif # with_python3
79f9dc
79f9dc
%if %{with docs}
79f9dc
79f9dc
%package -n python-%{sname}-doc
79f9dc
Summary: The pyghmi library documentation
79f9dc
79f9dc
%if 0%{?with_python2}
79f9dc
BuildRequires: python-sphinx
79f9dc
BuildRequires: python2-openstackdocstheme
79f9dc
%else
79f9dc
BuildRequires: python3-sphinx
79f9dc
BuildRequires: python3-openstackdocstheme
79f9dc
%endif
79f9dc
79f9dc
%description -n python-%{sname}-doc
79f9dc
Documentation for the pyghmi library
79f9dc
79f9dc
%endif
79f9dc
79f9dc
%prep
79f9dc
%setup -qn %{sname}-%{version}
79f9dc
%patch0 -p1
79f9dc
%patch1 -p1
79f9dc
79f9dc
# NOTE(dtantsur): pyghmi is actual fine with older dateutil, 2.8.1 is missing
79f9dc
# from both Fedora and CentOS currently. See
79f9dc
# https://bugzilla.redhat.com/show_bug.cgi?id=1835084
79f9dc
sed -i 's/python-dateutil.*/python-dateutil>=2.6.1/' requirements.txt
79f9dc
79f9dc
sed -i s/@@REDHATVERSION@@/%{version}/ pyghmi/version.py
79f9dc
# If not PBR, use the setup.py.tmpl
79f9dc
sed -e "s/#VERSION#/%{version}/" setup.py.tmpl > setup.py
79f9dc
79f9dc
%build
79f9dc
%if 0%{?with_python3}
79f9dc
%py3_build
79f9dc
%if %{with docs}
79f9dc
%{__python3} setup.py build_sphinx -b html
79f9dc
%endif
79f9dc
%endif # with_python3
79f9dc
79f9dc
%if 0%{?with_python2}
79f9dc
%py2_build
79f9dc
%if %{with docs}
79f9dc
%{__python2} setup.py build_sphinx -b html
79f9dc
%endif
79f9dc
%endif
79f9dc
79f9dc
# remove the sphinx-build leftovers
79f9dc
rm -rf doc/build/html/.{doctrees,buildinfo}
79f9dc
79f9dc
%install
79f9dc
%if 0%{?with_python3}
79f9dc
%py3_install
79f9dc
79f9dc
# rename python3 binary
79f9dc
pushd %{buildroot}/%{_bindir}
79f9dc
mv pyghmicons pyghmicons-%{python3_version}
79f9dc
ln -s pyghmicons-%{python3_version} pyghmicons-3
79f9dc
ln -s pyghmicons-3 pyghmicons
79f9dc
mv pyghmiutil pyghmiutil-%{python3_version}
79f9dc
ln -s pyghmiutil-%{python3_version} pyghmiutil-3
79f9dc
ln -s pyghmiutil-3 pyghmiutil
79f9dc
mv virshbmc virshbmc-%{python3_version}
79f9dc
ln -s virshbmc-%{python3_version} virshbmc-3
79f9dc
ln -s virshbmc-3 virshbmc
79f9dc
popd
79f9dc
79f9dc
%endif # with_python3
79f9dc
79f9dc
%if 0%{?with_python2}
79f9dc
%py2_install
79f9dc
%endif
79f9dc
79f9dc
%if 0%{?with_python3}
79f9dc
%files -n python3-%{sname}
79f9dc
%license LICENSE
79f9dc
%{_bindir}/pyghmicons*
79f9dc
%{_bindir}/pyghmiutil*
79f9dc
%{_bindir}/virshbmc*
79f9dc
%{_bindir}/fakebmc
79f9dc
%{python3_sitelib}/%{sname}
79f9dc
%{python3_sitelib}/%{sname}-*.egg-info
79f9dc
%exclude %{python3_sitelib}/%{sname}/tests
79f9dc
79f9dc
%files -n python3-%{sname}-tests
79f9dc
%license LICENSE
79f9dc
%{python3_sitelib}/%{sname}/tests
79f9dc
%endif # with_python3
79f9dc
79f9dc
%if 0%{?with_python2}
79f9dc
%files -n python2-%{sname}
79f9dc
%license LICENSE
79f9dc
%{_bindir}/pyghmicons
79f9dc
%{_bindir}/pyghmiutil
79f9dc
%{_bindir}/virshbmc
79f9dc
%{_bindir}/fakebmc
79f9dc
%{python2_sitelib}/%{sname}
79f9dc
%{python2_sitelib}/%{sname}-*.egg-info
79f9dc
%exclude %{python2_sitelib}/%{sname}/tests
79f9dc
79f9dc
%files -n python2-%{sname}-tests
79f9dc
%license LICENSE
79f9dc
%{python2_sitelib}/%{sname}/tests
79f9dc
%endif
79f9dc
79f9dc
%if %{with docs}
79f9dc
79f9dc
%files -n python-%{sname}-doc
79f9dc
%license LICENSE
79f9dc
%doc doc/build/html README.md
79f9dc
79f9dc
%endif # with docs
79f9dc
79f9dc
%changelog
79f9dc
* Wed Feb 23 2022 Pavel Cahyna <pcahyna@redhat.com> - 1.5.34-2
79f9dc
- Updated to 1.5.34.
79f9dc
79f9dc
* Fri Aug  6 2021 Pavel Cahyna <pcahyna@redhat.com> - 1.5.29-1
79f9dc
- Updated to 1.5.29.
79f9dc
- Avoid dependency on python-pbr, conditionalize docs build, to allow building in RHEL.
79f9dc
  Inspired by python-sushy.
79f9dc
79f9dc
* Fri Nov 06 2020 Joel Capitao <jcapitao@redhat.com> - 1.5.19-1
79f9dc
- Updated to 1.5.19.
79f9dc
79f9dc
* Sun Aug 30 2020 Dmitry Tantsur <divius.inside@gmail.com> - 1.5.16-1
79f9dc
- Updated to 1.5.16.
79f9dc
79f9dc
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.14-5
79f9dc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
79f9dc
79f9dc
* Tue May 26 2020 Dmitry Tantsur <divius.inside@gmail.com> - 1.5.14-4
79f9dc
- Relax dateutil requirement in requirement.txt as well (#1835084)
79f9dc
79f9dc
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1.5.14-3
79f9dc
- Rebuilt for Python 3.9
79f9dc
79f9dc
* Wed May 13 2020 Yatin Karel <ykarel@redhat.com> - 1.5.14-2
79f9dc
- Fix typo in requirements
79f9dc
79f9dc
* Mon May 11 2020 Yatin Karel <ykarel@redhat.com> - 1.5.14-1
79f9dc
- Updated to 1.5.14.
79f9dc
79f9dc
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.2.16-4
79f9dc
- Rebuilt for Python 3.8.0rc1 (#1748018)
79f9dc
79f9dc
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.2.16-3
79f9dc
- Rebuilt for Python 3.8
79f9dc
79f9dc
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.16-2
79f9dc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
79f9dc
79f9dc
* Tue Feb 05 2019 Alfredo Moralejo <amoralej@redhat.com> - 1.2.16-1
79f9dc
- Updated to 1.2.16.
79f9dc
79f9dc
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.4-5
79f9dc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
79f9dc
79f9dc
* Thu Oct 11 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.2.4-4
79f9dc
- Python2 binary package has been removed
79f9dc
  See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
79f9dc
79f9dc
* Tue Aug 14 2018 Ilya Etingof <etingof@gmail.com> - 1.2.4-3
79f9dc
- Added Python 3 build
79f9dc
79f9dc
* Mon Aug 13 2018 Ilya Etingof <etingof@gmail.com> - 1.2.4-1
79f9dc
- Upstream 1.2.4
79f9dc
79f9dc
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.22-4
79f9dc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
79f9dc
79f9dc
* Fri Feb 09 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.0.22-3
79f9dc
- Update Python 2 dependency declarations to new packaging standards
79f9dc
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
79f9dc
79f9dc
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.22-2
79f9dc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
79f9dc
79f9dc
* Thu Oct  5 2017 Haïkel Guémar <hguemar@fedoraproject.org> - 1.0.22-1
79f9dc
- Upstream 1.0.22
79f9dc
79f9dc
* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.0.12-4
79f9dc
- Python 2 binary package renamed to python2-pyghmi
79f9dc
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
79f9dc
79f9dc
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.12-3
79f9dc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
79f9dc
79f9dc
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.12-2
79f9dc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
79f9dc
79f9dc
* Mon Nov 07 2016 Lucas Alvares Gomes <lucasagomes@gmail.com> - 1.0.12-1
79f9dc
- Rebased to 1.0.12
79f9dc
79f9dc
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.0-3
79f9dc
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
79f9dc
79f9dc
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.0-2
79f9dc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
79f9dc
79f9dc
* Fri Sep 25 2015 Lucas Alvares Gomes <lucasagomes@gmail.com> - 0.8.0-1
79f9dc
- Rebased to 0.8.0
79f9dc
79f9dc
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.9-3
79f9dc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
79f9dc
79f9dc
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.9-2
79f9dc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
79f9dc
79f9dc
* Thu Feb 20 2014 Lucas Alvares Gomes <lucasagomes@gmail.com> - 0.5.9-1
79f9dc
- Initial package.