[python-lmiwbem] introduce python3 build

Peter Hatina phatina at fedoraproject.org
Mon Mar 9 13:10:11 UTC 2015


commit 719785e92d63b116d1db3ded900574ca0905490e
Author: Peter Hatina <phatina at redhat.com>
Date:   Mon Mar 9 13:52:22 2015 +0100

    introduce python3 build

 python-lmiwbem.spec | 45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)
---
diff --git a/python-lmiwbem.spec b/python-lmiwbem.spec
index 7dc4ab5..0b5d4bd 100644
--- a/python-lmiwbem.spec
+++ b/python-lmiwbem.spec
@@ -1,6 +1,9 @@
+%global py3build 1
+%global py3dir %{_builddir}/python3-%{name}-%{version}-%{release}
+
 Name:           python-lmiwbem
 Version:        0.7.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Python WBEM Client
 License:        LGPLv2+
 URL:            https://github.com/phatina/python-lmiwbem
@@ -31,6 +34,17 @@ Obsoletes:      lmiwbem <= 0.6.0-3
 %{name} is a Python library, which performs CIM operations using CIM-XML
 protocol. The library tries to mimic PyWBEM.
 
+%if %{py3build}
+%package -n python3-lmiwbem
+Summary:        Python3 WBEM Client
+BuildRequires:  python3-devel
+BuildRequires:  boost-python3-devel >= 1.50.0
+Requires:       boost-python3 >= 1.50.0
+
+%description -n python3-lmiwbem
+%{summary}
+%endif
+
 %package doc
 Summary:        Documentation for %{name}
 Group:          Documentation
@@ -44,24 +58,53 @@ Obsoletes:      lmiwbem-doc <= 0.6.0-3
 %prep
 %setup -q -n %{name}-%{version}
 
+%if %{py3build}
+# Copy the whole directory to Python3 build
+rm -fr %{py3dir}
+cp -a . %{py3dir}
+%endif
+
 %build
 %configure --with-doc=yes
 make %{?_smp_mflags}
+%if %{py3build}
+# Build Python3 version
+pushd %{py3dir}
+%configure --with-python3
+make %{?_smp_mflags}
+popd
+%endif
 
 %install
 make DESTDIR=%{buildroot} install
 find %{buildroot} -name '*.la' | xargs rm -f
+%if %{py3build}
+# Install Python3 version
+pushd %{py3dir}
+make DESTDIR=%{buildroot} install
+find %{buildroot} -name '*.la' | xargs rm -f
+popd
+%endif
 
 %files
 %doc COPYING README.md
 %{python2_sitearch}/lmiwbem/
 
+%if %{py3build}
+%files -n python3-lmiwbem
+%doc COPYING README.md
+%{python3_sitearch}/lmiwbem
+%endif
+
 %files doc
 %doc COPYING README.md
 %dir %{_docdir}/%{name}-%{version}
 %{_docdir}/%{name}-%{version}/html
 
 %changelog
+* Mon Mar  9 2015 Peter Hatina <phatina at redhat.com> - 0.7.1-2
+- introduce python3 subpackage
+
 * Mon Mar  2 2015 Peter Hatina <phatina at redhat.com> - 0.7.1-1
 - upgrade to 0.7.1
 - rename to python-lmiwbem


More information about the scm-commits mailing list