3 # This spec file assumes you are building on a Fedora or RHEL version
4 # that's still supported by the vendor. It may work on other distros
5 # or versions, but no effort will be made to ensure that going forward
9 %if (0%{?fedora} && 0%{?fedora} >= %{min_fedora}) || (0%{?rhel} && 0%{?rhel} >= %{min_rhel})
10 %define supported_platform
1
12 %define supported_platform
0
15 %define _with_python2
1
16 %if 0%{?fedora} > 29 || 0%{?rhel} > 7
17 %define _with_python2
0
20 %define _with_python3
0
21 %if 0%{?fedora} || 0%{?rhel} > 7
22 %define _with_python3
1
25 # Whether py2 packages are assumed to have python2- name prefix
26 %define py2_versioned_deps
0
27 %if 0%{?fedora} || 0%{?rhel} > 7
28 %define py2_versioned_deps
1
31 %{!?with_python2: %define with_python2 %{_with_python2}}
32 %{!?with_python3: %define with_python3 %{_with_python3}}
34 Summary: The libvirt virtualization API python2 binding
37 Release: 1%{?dist}%{?extra_release}
38 Source0: http
://libvirt.org
/sources
/python
/%{name}-%{version}.tar.gz
39 Url
: http
://libvirt.org
41 Group: Development
/Libraries
42 BuildRequires
: libvirt
-devel
== %{version}
44 %if %{py2_versioned_deps}
45 BuildRequires
: python2
-devel
46 BuildRequires
: python2
-nose
47 BuildRequires
: python2
-lxml
49 BuildRequires
: python
-devel
50 BuildRequires
: python
-nose
51 BuildRequires
: python
-lxml
55 BuildRequires
: python3
-devel
56 BuildRequires
: python3
-nose
57 BuildRequires
: python3
-lxml
60 # Don't want provides for python shared objects
62 %{?filter_provides_in: %filter_provides_in %{python_sitearch}/.*\.so}
65 %{?filter_provides_in: %filter_provides_in %{python3_sitearch}/.*\.so}
70 The libvirt
-python package contains a module that permits applications
71 written
in the Python programming language to use the interface
72 supplied by the libvirt library to use the virtualization capabilities
73 of recent versions of Linux
(and other OSes
).
76 %package -n python2
-libvirt
77 Summary: The libvirt virtualization API python2 binding
78 Url
: http
://libvirt.org
80 Group: Development
/Libraries
81 %{?python_provide:%python_provide python2-libvirt}
82 Provides: libvirt
-python
= %{version}-%{release}
83 Obsoletes
: libvirt
-python
<= 3.6.0-1%{?dist}
85 %description -n python2
-libvirt
86 The python2
-libvirt package contains a module that permits applications
87 written
in the Python programming language to use the interface
88 supplied by the libvirt library to use the virtualization capabilities
89 of recent versions of Linux
(and other OSes
).
93 %package -n python3
-libvirt
94 Summary: The libvirt virtualization API python3 binding
95 Url
: http
://libvirt.org
97 Group: Development
/Libraries
98 %{?python_provide:%python_provide python3-libvirt}
99 Provides: libvirt
-python3
= %{version}-%{release}
100 Obsoletes
: libvirt
-python3
<= 3.6.0-1%{?dist}
102 %description -n python3
-libvirt
103 The python3
-libvirt package contains a module that permits applications
104 written
in the Python programming language to use the interface
105 supplied by the libvirt library to use the virtualization capabilities
106 of recent versions of Linux
(and other OSes
).
112 # Unset execute bit for example scripts; it can introduce spurious
113 # RPM dependencies, like /usr/bin/python which can pull in python2
114 # for the -python3 package
115 find examples
-type f
-exec chmod
0644 \
{\
} \
;
118 %if ! %{supported_platform}
119 echo "This RPM requires either Fedora
>= %{min_fedora} or RHEL >= %{min_rhel}"
124 CFLAGS
="$RPM_OPT_FLAGS"
%{__python} setup.py build
127 CFLAGS
="$RPM_OPT_FLAGS"
%{__python3} setup.py build
132 %{__python} setup.py install --skip-build --root=%{buildroot}
135 %{__python3} setup.py install --skip-build --root=%{buildroot}
140 %{__python} setup.py
test
143 %{__python3} setup.py
test
147 %files -n python2
-libvirt
148 %defattr(-,root
,root
)
149 %doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples
/
150 %{python_sitearch}/libvirt.py
*
151 %{python_sitearch}/libvirt_qemu.py
*
152 %{python_sitearch}/libvirt_lxc.py
*
153 %{python_sitearch}/libvirtmod
*
154 %{python_sitearch}/*egg
-info
158 %files -n python3
-libvirt
159 %defattr(-,root
,root
)
160 %doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples
/
161 %{python3_sitearch}/libvirt.py
*
162 %{python3_sitearch}/libvirtaio.py
*
163 %{python3_sitearch}/libvirt_qemu.py
*
164 %{python3_sitearch}/libvirt_lxc.py
*
165 %{python3_sitearch}/__pycache__
/libvirt.cpython
-*.py
*
166 %{python3_sitearch}/__pycache__
/libvirt_qemu.cpython
-*.py
*
167 %{python3_sitearch}/__pycache__
/libvirt_lxc.cpython
-*.py
*
168 %{python3_sitearch}/__pycache__
/libvirtaio.cpython
-*.py
*
169 %{python3_sitearch}/libvirtmod
*
170 %{python3_sitearch}/*egg
-info