[libvirt] [PATCH python 5/7] Adapt to rename of py2 RPMs from python- to python2- prefix

Daniel P. Berrange posted 7 patches 7 years, 4 months ago
[libvirt] [PATCH python 5/7] Adapt to rename of py2 RPMs from python- to python2- prefix
Posted by Daniel P. Berrange 7 years, 4 months ago
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 libvirt-python.spec.in | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index b667ebe..cc5a5a5 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -18,6 +18,12 @@
 %define _with_python3 1
 %endif
 
+# Whether py2 packages are assumed to have python2- name prefix
+%define py2_versioned_deps 0
+%if 0%{?fedora} || 0%{?rhel} > 7
+%define py2_versioned_deps 1
+%endif
+
 %{!?with_python2: %define with_python2 %{_with_python2}}
 %{!?with_python3: %define with_python3 %{_with_python3}}
 
@@ -31,10 +37,16 @@ License: LGPLv2+
 Group: Development/Libraries
 BuildRequires: libvirt-devel >= @C_VERSION@
 %if %{with_python2}
+%if %{py2_versioned_deps}
+BuildRequires: python2-devel
+BuildRequires: pyth2on2-nose
+BuildRequires: python2-lxml
+%else
 BuildRequires: python-devel
 BuildRequires: python-nose
 BuildRequires: python-lxml
 %endif
+%endif
 %if %{with_python3}
 BuildRequires: python3-devel
 BuildRequires: python3-nose
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH python 5/7] Adapt to rename of py2 RPMs from python- to python2- prefix
Posted by Daniel P. Berrange 7 years, 4 months ago
On Thu, Jan 11, 2018 at 04:43:37PM +0000, Daniel P. Berrange wrote:
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  libvirt-python.spec.in | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
> index b667ebe..cc5a5a5 100644
> --- a/libvirt-python.spec.in
> +++ b/libvirt-python.spec.in
> @@ -18,6 +18,12 @@
>  %define _with_python3 1
>  %endif
>  
> +# Whether py2 packages are assumed to have python2- name prefix
> +%define py2_versioned_deps 0
> +%if 0%{?fedora} || 0%{?rhel} > 7
> +%define py2_versioned_deps 1
> +%endif
> +
>  %{!?with_python2: %define with_python2 %{_with_python2}}
>  %{!?with_python3: %define with_python3 %{_with_python3}}
>  
> @@ -31,10 +37,16 @@ License: LGPLv2+
>  Group: Development/Libraries
>  BuildRequires: libvirt-devel >= @C_VERSION@
>  %if %{with_python2}
> +%if %{py2_versioned_deps}
> +BuildRequires: python2-devel
> +BuildRequires: pyth2on2-nose

Yes, I will remove this intentional typo i added during testing :-)

> +BuildRequires: python2-lxml
> +%else
>  BuildRequires: python-devel
>  BuildRequires: python-nose
>  BuildRequires: python-lxml
>  %endif
> +%endif
>  %if %{with_python3}
>  BuildRequires: python3-devel
>  BuildRequires: python3-nose
> -- 
> 2.14.3
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH python 5/7] Adapt to rename of py2 RPMs from python- to python2- prefix
Posted by Pavel Hrdina 7 years, 4 months ago
On Thu, Jan 11, 2018 at 04:43:37PM +0000, Daniel P. Berrange wrote:
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  libvirt-python.spec.in | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>

In addition we should rename __python RPM macro to __python2 for fedora
and rhel > 7.  This applies to python_sitearch as well.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH python 5/7] Adapt to rename of py2 RPMs from python- to python2- prefix
Posted by Daniel P. Berrange 7 years, 4 months ago
On Fri, Jan 12, 2018 at 12:31:46PM +0100, Pavel Hrdina wrote:
> On Thu, Jan 11, 2018 at 04:43:37PM +0000, Daniel P. Berrange wrote:
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > ---
> >  libvirt-python.spec.in | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> 
> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
> 
> In addition we should rename __python RPM macro to __python2 for fedora
> and rhel > 7.  This applies to python_sitearch as well.

I don't think we should do that (yet) as python_sitearch still works and
AFAIK isn't going to be changed to point to the py3 binary. This avoids
need for more conditionals.

Once RHEL8 comes out and we drop RHEL6 as a target for libvirt, we can
do the swtich, since IIUC RHEL-7 has the python2_* macros available.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list