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 default
repos.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
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 @@
+%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 >= @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 interface
supplied by the libvirt library to use the virtualization capabilities
of recent versions of Linux (and other OSes).
+%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 permits 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
%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 \{\} \;
%build
+%if %{with_python2}
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
+%endif
%if %{with_python3}
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
%endif
%install
+%if %{with_python2}
%{__python} setup.py install --skip-build --root=%{buildroot}
+%endif
%if %{with_python3}
%{__python3} setup.py install --skip-build --root=%{buildroot}
%endif
%check
+%if %{with_python2}
%{__python} setup.py test
+%endif
%if %{with_python3}
%{__python3} setup.py test
%endif
+%if %{with_python2}
%files -n python2-libvirt
%defattr(-,root,root)
%doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/
@@ -98,6 +110,7 @@ CFLAGS="$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
%if %{with_python3}
%files -n python3-libvirt
--
2.14.3
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Thu, Jan 11, 2018 at 04:43:33PM +0000, Daniel P. Berrange wrote: > 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 default > repos. Prior to this patch we should also fix the "wrong" usage of "python_sitearch" on line 26: # Don't want provides for python shared objects %{?filter_provides_in: %filter_provides_in %{python_sitearch}/.*\.so} %{?filter_setup} We should use python{2,3}_sitearch instead since the old python_sitearch points only to the default version. Currently we will not filter the *.so files for python3. Otherwise, the patch itself looks good. Pavel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Fri, Jan 12, 2018 at 12:15:19PM +0100, Pavel Hrdina wrote: > On Thu, Jan 11, 2018 at 04:43:33PM +0000, Daniel P. Berrange wrote: > > 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 default > > repos. > > Prior to this patch we should also fix the "wrong" usage of > "python_sitearch" on line 26: > > # Don't want provides for python shared objects > %{?filter_provides_in: %filter_provides_in %{python_sitearch}/.*\.so} > %{?filter_setup} > > We should use python{2,3}_sitearch instead since the old python_sitearch > points only to the default version. Currently we will not filter > the *.so files for python3. On Fedora 27, this filter stuff apparently has no effect. I see the same data in both py2 and py3 sub RPMs rpm -q --requires --provides python2-libvirt-debuginfo-3.10.0-1.fc27.x86_64.rpm libvirt-python-debuginfo(x86-64) = 3.10.0-1.fc27 rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(PayloadIsXz) <= 5.2-1 debuginfo(build-id) = 5fb8c6a9dce927333cecf765adaf40c420a04f21 debuginfo(build-id) = d59579a7c85ce5b002cc6b3e0a0be7932c041fe4 debuginfo(build-id) = e791f98736c9006bbe3b324abf035b0b119506f9 python2-libvirt-debuginfo = 3.10.0-1.fc27 python2-libvirt-debuginfo(x86-64) = 3.10.0-1.fc27 [berrange@t460 libvirt-python] $ rpm -q --requires --provides python3-libvirt-debuginfo-3.10.0-1.fc27.x86_64.rpm libvirt-python-debuginfo(x86-64) = 3.10.0-1.fc27 rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(PayloadIsXz) <= 5.2-1 debuginfo(build-id) = 28d17edad0f257efbc68790ecd8c970fc153fe74 debuginfo(build-id) = 4c4aceebea990736cdcf58d122a231a6260f5474 debuginfo(build-id) = 7ff2ac4cefcee10d44b6dc73ebe0f1ed3f68f6ec python3-libvirt-debuginfo = 3.10.0-1.fc27 python3-libvirt-debuginfo(x86-64) = 3.10.0-1.fc27 Perhaps this was working around a bug on older RHEL ? 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
On Fri, Jan 12, 2018 at 03:42:57PM +0000, Daniel P. Berrange wrote: > On Fri, Jan 12, 2018 at 12:15:19PM +0100, Pavel Hrdina wrote: > > On Thu, Jan 11, 2018 at 04:43:33PM +0000, Daniel P. Berrange wrote: > > > 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 default > > > repos. > > > > Prior to this patch we should also fix the "wrong" usage of > > "python_sitearch" on line 26: > > > > # Don't want provides for python shared objects > > %{?filter_provides_in: %filter_provides_in %{python_sitearch}/.*\.so} > > %{?filter_setup} > > > > We should use python{2,3}_sitearch instead since the old python_sitearch > > points only to the default version. Currently we will not filter > > the *.so files for python3. > > On Fedora 27, this filter stuff apparently has no effect. I see the same > data in both py2 and py3 sub RPMs > > rpm -q --requires --provides python2-libvirt-debuginfo-3.10.0-1.fc27.x86_64.rpm > libvirt-python-debuginfo(x86-64) = 3.10.0-1.fc27 > rpmlib(CompressedFileNames) <= 3.0.4-1 > rpmlib(FileDigests) <= 4.6.0-1 > rpmlib(PayloadFilesHavePrefix) <= 4.0-1 > rpmlib(PayloadIsXz) <= 5.2-1 > debuginfo(build-id) = 5fb8c6a9dce927333cecf765adaf40c420a04f21 > debuginfo(build-id) = d59579a7c85ce5b002cc6b3e0a0be7932c041fe4 > debuginfo(build-id) = e791f98736c9006bbe3b324abf035b0b119506f9 > python2-libvirt-debuginfo = 3.10.0-1.fc27 > python2-libvirt-debuginfo(x86-64) = 3.10.0-1.fc27 > > [berrange@t460 libvirt-python] > $ rpm -q --requires --provides python3-libvirt-debuginfo-3.10.0-1.fc27.x86_64.rpm > libvirt-python-debuginfo(x86-64) = 3.10.0-1.fc27 > rpmlib(CompressedFileNames) <= 3.0.4-1 > rpmlib(FileDigests) <= 4.6.0-1 > rpmlib(PayloadFilesHavePrefix) <= 4.0-1 > rpmlib(PayloadIsXz) <= 5.2-1 > debuginfo(build-id) = 28d17edad0f257efbc68790ecd8c970fc153fe74 > debuginfo(build-id) = 4c4aceebea990736cdcf58d122a231a6260f5474 > debuginfo(build-id) = 7ff2ac4cefcee10d44b6dc73ebe0f1ed3f68f6ec > python3-libvirt-debuginfo = 3.10.0-1.fc27 > python3-libvirt-debuginfo(x86-64) = 3.10.0-1.fc27 > > > Perhaps this was working around a bug on older RHEL ? Sigh, ignore this. It helps if i use the actual RPms, not the debuginfo RPMs. 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
© 2016 - 2025 Red Hat, Inc.