From nobody Wed May 14 21:53:45 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 151577325354664.23106232451289; Fri, 12 Jan 2018 08:07:33 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2CD5AA452D; Fri, 12 Jan 2018 16:07:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6623060460; Fri, 12 Jan 2018 16:07:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4948C3FAE2; Fri, 12 Jan 2018 16:06:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0CG6r4O011302 for ; Fri, 12 Jan 2018 11:06:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5E9F317997; Fri, 12 Jan 2018 16:06:52 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id C323017DE7; Fri, 12 Jan 2018 16:06:51 +0000 (UTC) From: "Daniel P. Berrange" To: libvir-list@redhat.com Date: Fri, 12 Jan 2018 16:06:37 +0000 Message-Id: <20180112160645.15499-2-berrange@redhat.com> In-Reply-To: <20180112160645.15499-1-berrange@redhat.com> References: <20180112160645.15499-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH python v2 1/9] Allow disabling of python2 RPM build X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 12 Jan 2018 16:07:32 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" With Fedora modularity, it is possible to have add-on repos for multiple versions of python3. It is thus desirable to be able to build libvirt-python in these repos, with only the python3 sub-RPMs enabled. Thus also helps if future RHEL/Fedora drop python2 entirely from their defa= ult repos. Signed-off-by: Daniel P. Berrange --- libvirt-python.spec.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in index 4d0262d..5bbebeb 100644 --- a/libvirt-python.spec.in +++ b/libvirt-python.spec.in @@ -1,4 +1,5 @@ =20 +%define with_python2 1 %define with_python3 0 %if 0%{?fedora} %define with_python3 1 @@ -13,9 +14,11 @@ Url: http://libvirt.org License: LGPLv2+ Group: Development/Libraries BuildRequires: libvirt-devel >=3D @C_VERSION@ +%if %{with_python2} BuildRequires: python-devel BuildRequires: python-nose BuildRequires: python-lxml +%endif %if %{with_python3} BuildRequires: python3-devel BuildRequires: python3-nose @@ -32,6 +35,7 @@ written in the Python programming language to use the int= erface supplied by the libvirt library to use the virtualization capabilities of recent versions of Linux (and other OSes). =20 +%if %{with_python2} %package -n python2-libvirt Summary: The libvirt virtualization API python2 binding Url: http://libvirt.org @@ -46,6 +50,7 @@ The python2-libvirt package contains a module that permit= s applications written in the Python programming language to use the interface supplied by the libvirt library to use the virtualization capabilities of recent versions of Linux (and other OSes). +%endif =20 %if %{with_python3} %package -n python3-libvirt @@ -73,23 +78,30 @@ of recent versions of Linux (and other OSes). find examples -type f -exec chmod 0644 \{\} \; =20 %build +%if %{with_python2} CFLAGS=3D"$RPM_OPT_FLAGS" %{__python} setup.py build +%endif %if %{with_python3} CFLAGS=3D"$RPM_OPT_FLAGS" %{__python3} setup.py build %endif =20 %install +%if %{with_python2} %{__python} setup.py install --skip-build --root=3D%{buildroot} +%endif %if %{with_python3} %{__python3} setup.py install --skip-build --root=3D%{buildroot} %endif =20 %check +%if %{with_python2} %{__python} setup.py test +%endif %if %{with_python3} %{__python3} setup.py test %endif =20 +%if %{with_python2} %files -n python2-libvirt %defattr(-,root,root) %doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/ @@ -98,6 +110,7 @@ CFLAGS=3D"$RPM_OPT_FLAGS" %{__python3} setup.py build %{_libdir}/python2*/site-packages/libvirt_lxc.py* %{_libdir}/python2*/site-packages/libvirtmod* %{_libdir}/python2*/site-packages/*egg-info +%endif =20 %if %{with_python3} %files -n python3-libvirt --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list