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