diff --git a/pywbem.spec b/pywbem.spec index ff44f15..fdab326 100644 --- a/pywbem.spec +++ b/pywbem.spec @@ -1,17 +1,25 @@ -%global py3_build_dir %{_builddir}/%{name}-%{version}-%{release}-python3 +%global py2_build_dir %{_builddir}/%{name}-%{version}-%{release}-python2 + +%if 0%{?rhel} > 7 || 0%{?fedora} > 28 +%bcond_with python2 +%else +%bcond_without python2 +%endif Name: pywbem Version: 0.12.2 -Release: 1%{?dist} -Summary: Python2 WBEM Client and Provider Interface +Release: 2%{?dist} +Summary: Python WBEM client interface and related utilities Group: Development/Libraries License: LGPLv2 URL: https://github.com/pywbem/pywbem Source0: https://github.com/pywbem/pywbem/archive/%{version}.tar.gz -BuildRequires: python2-pip +%if %{with python2} +BuildRequires: python2-pip python2-pbr BuildRequires: python2-pyyaml python2-ply python2-rpm-macros +%endif BuildRequires: python3-pip python3-PyYAML python3-ply python3-rpm-macros -BuildRequires: python3-pbr python2-pbr +BuildRequires: python3-pbr BuildArch: noarch %global _description\ @@ -30,21 +38,23 @@ easiest way to write providers on the planet. %description %_description +%if %{with python2} %package -n python2-pywbem Summary: %summary Requires: m2crypto python2-pyyaml python2-six python2-ply +Requires: python2-mock python2-pbr %{?python_provide:%python_provide python2-pywbem} -# Remove before F30 Provides: pywbem%{?_isa} = %{version}-%{release} Obsoletes: pywbem < %{version}-%{release} %description -n python2-pywbem %_description +%endif %package -n python3-pywbem Group: Development/Libraries Summary: Python3 WBEM Client and Provider Interface BuildArch: noarch -Requires: python3-PyYAML python3-six python3-ply +Requires: python3-PyYAML python3-six python3-ply python3-mock python3-pbr %description -n python3-pywbem A WBEM client allows issuing operations to a WBEM server, using the CIM @@ -53,6 +63,7 @@ and DSP0201. The CIM/WBEM infrastructure is used for a wide variety of systems management tasks supported by systems running WBEM servers. See WBEM Standards for more information about WBEM. +%if %{with python2} %package twisted Group: Development/Libraries Summary: WBEM client bindings for Twisted Python @@ -64,42 +75,54 @@ BuildArch: noarch This module contains factory classes that produce WBEM5Client instances that perform WBEM requests over HTTP using the twisted.protocols.http.HTTPClient base class. +%endif %prep %setup -q -n %{name}-%{version} %build -cp -a . %{py3_build_dir} -PBR_VERSION="%{version}" CFLAGS="%{optflags}" %{__python2} setup.py build -pushd %{py3_build_dir} +cp -a . %{py2_build_dir} PBR_VERSION="%{version}" CFLAGS="%{optflags}" %{__python3} setup.py build + + +%if %{with python2} +pushd %{py2_build_dir} +PBR_VERSION="%{version}" CFLAGS="%{optflags}" %{__python2} setup.py build popd +%endif %install rm -rf %{buildroot} -env PYTHONPATH=%{buildroot}/%{python2_sitelib} \ - PBR_VERSION="%{version}" \ - %{__python2} setup.py install -O1 --skip-build --root %{buildroot} -rm -rf %{buildroot}/usr/bin/ -install -m644 attic/twisted_client.py \ - %{buildroot}/%{python2_sitelib}/pywbem/twisted_client.py -install -m644 LICENSE.txt \ - %{buildroot}/%{python2_sitelib}/pywbem/LICENSE.txt - -pushd %{py3_build_dir} env PYTHONPATH=%{buildroot}/%{python3_sitelib} \ PBR_VERSION="%{version}" \ %{__python3} setup.py install -O1 --skip-build --root %{buildroot} install -m644 LICENSE.txt \ %{buildroot}/%{python3_sitelib}/pywbem/LICENSE.txt rm -rf %{buildroot}/usr/bin/*.bat -popd +%if %{with python2} +pushd %{py2_build_dir} +env PYTHONPATH=%{buildroot}/%{python2_sitelib} \ + PBR_VERSION="%{version}" \ + %{__python2} setup.py install -O1 --skip-build --root %{buildroot} +install -m644 LICENSE.txt \ + %{buildroot}/%{python2_sitelib}/pywbem/LICENSE.txt +install -m644 attic/twisted_client.py \ + %{buildroot}/%{python2_sitelib}/pywbem/twisted_client.py +rm -rf %{buildroot}/usr/bin/ +popd +%endif + +%if %{with python2} %files -n python2-pywbem %{python2_sitelib}/*.egg-info %{python2_sitelib}/pywbem/ %{python2_sitelib}/pywbem_mock/ +%files twisted +%{python2_sitelib}/pywbem/twisted_client.py* +%endif + %files -n python3-pywbem %{python3_sitelib}/*.egg-info %{python3_sitelib}/pywbem/ @@ -109,10 +132,10 @@ popd %{_bindir}/wbemcli.py %doc README.rst -%files twisted -%{python_sitelib}/pywbem/twisted_client.py* - %changelog +* Fri May 18 2018 Gris Ge - 0.12.2-2 +- Remove python2 for F29+. Add missing python3-pbr runtime requirement. + * Fri May 04 2018 Gris Ge - 0.12.2-1 - Upgrade to 0.12.2.