From f098bf996d1b63bfda75f5fadfad54183da71292 Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Fri, 10 Aug 2018 15:14:28 +0200 Subject: [PATCH] Add spec for python3-pyghmi package build The Python2 package has been renamed from python-pyghmi into python2-pyghmi Change-Id: I2a6064bc98b0d819487e73e264d68e38d3bedf84 --- python-pyghmi.spec | 117 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 102 insertions(+), 15 deletions(-) diff --git a/python-pyghmi.spec b/python-pyghmi.spec index 18fc1a8d..aecade39 100644 --- a/python-pyghmi.spec +++ b/python-pyghmi.spec @@ -1,8 +1,19 @@ -Summary: Python General Hardware Management Initiative (IPMI and others) -Name: python-pyghmi +%global with_python3 1 +%global sname pyghmi +%global common_summary Python General Hardware Management Initiative (IPMI and others) + +%global common_desc This is a pure Python implementation of IPMI protocol. \ +\ +The included pyghmicons and pyghmiutil scripts demonstrate how one may \ +incorporate the pyghmi library into a Python application. + +%global common_desc_tests Tests for the pyghmi library + +Summary: %{common_summary} +Name: python-%{sname} Version: %{?version:%{version}}%{!?version:%(python setup.py --version)} Release: %{?release:%{release}}%{!?release:1} -Source0: pyghmi-%{version}.tar.gz +Source0: %{sname}-%{version}.tar.gz License: Apache License, Version 2.0 Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot @@ -10,29 +21,105 @@ Prefix: %{_prefix} BuildArch: noarch Vendor: Jarrod Johnson Url: https://git.openstack.org/cgit/openstack/pyghmi -Requires: python-cryptography - %description -This is a pure python implementation of IPMI protocol. +%{common_desc} -pyghmicons and pyghmiutil are example scripts to show how one may incorporate -this library into python code +%package -n python2-%{sname} +Summary: %{common_summary} +%{?python_provide:%python_provide python2-%{sname}} +Requires: python2-cryptography +%description -n python2-%{sname} +%{common_desc} + +%package -n python2-%{sname}-tests +Summary: %{common_desc_tests} +Requires: python2-%{sname} = %{version}-%{release} + +%description -n python2-%{sname}-tests +%{common_desc_tests} + +%if 0%{?with_python3} + +%package -n python3-%{sname} +Summary: %{common_summary} +%{?python_provide:%python_provide python3-%{sname}} + +Requires: python3-cryptography + +%description -n python3-%{sname} +%{common_desc} + +%package -n python3-%{sname}-tests +Summary: %{common_desc_tests} +Requires: python3-%{sname} = %{version}-%{release} + +%description -n python3-%{sname}-tests +%{common_desc_tests} + +%endif # with_python3 + +%package -n python-%{sname}-doc +Summary: The pyghmi library documentation + +BuildRequires: python2-sphinx + +%description -n python-%{sname}-doc +Documentation for the pyghmi library %prep -%setup -n pyghmi-%{version} +%setup -n %{sname}-%{version} %build -python setup.py build +%py2_build +%if 0%{?with_python3} +%py3_build +%endif # with_python3 + +# generate html docs +%{__python2} setup.py build_sphinx -b html +# remove the sphinx-build leftovers +rm -rf doc/build/html/.{doctrees,buildinfo} %install -python setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES --prefix=/usr +# Setup directories +install -d -m 755 %{buildroot}%{_datadir}/%{sname} +install -d -m 755 %{buildroot}%{_sharedstatedir}/%{sname} +install -d -m 755 %{buildroot}%{_localstatedir}/log/%{sname} -%clean -rm -rf $RPM_BUILD_ROOT +%if 0%{?with_python3} +%py3_install -%files -f INSTALLED_FILES -%defattr(-,root,root) +%files -n python3-%{sname} +%license LICENSE +%{python3_sitelib}/%{sname} +%{python3_sitelib}/%{sname}-*.egg-info +%exclude %{python3_sitelib}/%{sname}/tests +%files -n python3-%{sname}-tests +%license LICENSE +%{python3_sitelib}/%{sname}/tests + +%endif # with_python3 + +%py2_install + +%files -n python2-%{sname} +%license LICENSE +%{python2_sitelib}/%{sname} +%{python2_sitelib}/%{sname}-*.egg-info +%exclude %{python2_sitelib}/%{sname}/tests + +%files -n python2-%{sname}-tests +%license LICENSE +%{python2_sitelib}/%{sname}/tests + +%files -n python-%{sname}-doc +%license LICENSE +%doc doc/build/html README.rst + +%changelog +* Fri Aug 10 2018 Ilya Etingof 0.1.0-1 +- Add Python 3 build