spec: Bump minimum supported Fedora version to 29
[libvirt-python/ericb.git] / libvirt-python.spec.in
blob64a30b52850a9769c1f4579ff8fc466a6a35dc8e
1 # -*- rpm-spec -*-
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
6 %define min_rhel 7
7 %define min_fedora 29
9 %if (0%{?fedora} && 0%{?fedora} >= %{min_fedora}) || (0%{?rhel} && 0%{?rhel} >= %{min_rhel})
10 %define supported_platform 1
11 %else
12 %define supported_platform 0
13 %endif
15 %define _with_python2 1
16 %if 0%{?fedora} || 0%{?rhel} > 7
17 %define _with_python2 0
18 %endif
20 %define _with_python3 0
21 %if 0%{?fedora} || 0%{?rhel} > 7
22 %define _with_python3 1
23 %endif
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
29 %endif
31 %{!?with_python2: %define with_python2 %{_with_python2}}
32 %{!?with_python3: %define with_python3 %{_with_python3}}
34 Summary: The libvirt virtualization API python2 binding
35 Name: libvirt-python
36 Version: @PY_VERSION@
37 Release: 1%{?dist}
38 Source0: http://libvirt.org/sources/python/%{name}-%{version}.tar.gz
39 Url: http://libvirt.org
40 License: LGPLv2+
41 BuildRequires: libvirt-devel == %{version}
42 %if %{with_python2}
43 %if %{py2_versioned_deps}
44 BuildRequires: python2-devel
45 BuildRequires: python2-nose
46 BuildRequires: python2-lxml
47 %else
48 BuildRequires: python-devel
49 BuildRequires: python-nose
50 BuildRequires: python-lxml
51 %endif
52 %endif
53 %if %{with_python3}
54 BuildRequires: python3-devel
55 BuildRequires: python3-nose
56 BuildRequires: python3-lxml
57 %endif
58 BuildRequires: gcc
60 # Don't want provides for python shared objects
61 %if %{with_python2}
62 %{?filter_provides_in: %filter_provides_in %{python2_sitearch}/.*\.so}
63 %endif
64 %if %{with_python3}
65 %{?filter_provides_in: %filter_provides_in %{python3_sitearch}/.*\.so}
66 %endif
67 %{?filter_setup}
69 %description
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).
75 %if %{with_python2}
76 %package -n python2-libvirt
77 Summary: The libvirt virtualization API python2 binding
78 Url: http://libvirt.org
79 License: LGPLv2+
80 %{?python_provide:%python_provide python2-libvirt}
81 Provides: libvirt-python = %{version}-%{release}
82 Obsoletes: libvirt-python <= 3.6.0-1%{?dist}
84 %description -n python2-libvirt
85 The python2-libvirt package contains a module that permits applications
86 written in the Python programming language to use the interface
87 supplied by the libvirt library to use the virtualization capabilities
88 of recent versions of Linux (and other OSes).
89 %endif
91 %if %{with_python3}
92 %package -n python3-libvirt
93 Summary: The libvirt virtualization API python3 binding
94 Url: http://libvirt.org
95 License: LGPLv2+
96 %{?python_provide:%python_provide python3-libvirt}
97 Provides: libvirt-python3 = %{version}-%{release}
98 Obsoletes: libvirt-python3 <= 3.6.0-1%{?dist}
100 %description -n python3-libvirt
101 The python3-libvirt package contains a module that permits applications
102 written in the Python programming language to use the interface
103 supplied by the libvirt library to use the virtualization capabilities
104 of recent versions of Linux (and other OSes).
105 %endif
107 %prep
108 %setup -q
110 # Unset execute bit for example scripts; it can introduce spurious
111 # RPM dependencies, like /usr/bin/python which can pull in python2
112 # for the -python3 package
113 find examples -type f -exec chmod 0644 \{\} \;
115 %build
116 %if ! %{supported_platform}
117 echo "This RPM requires either Fedora >= %{min_fedora} or RHEL >= %{min_rhel}"
118 exit 1
119 %endif
121 %if %{with_python2}
122 %if 0%{?fedora} || 0%{?rhel} >= 8
123 %py2_build
124 %else
125 CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
126 %endif
127 %endif
128 %if %{with_python3}
129 %if 0%{?fedora} || 0%{?rhel} >= 8
130 %py3_build
131 %else
132 CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
133 %endif
134 %endif
136 %install
137 %if %{with_python2}
138 %if 0%{?fedora} || 0%{?rhel} >= 8
139 %py2_install
140 %else
141 %{__python2} setup.py install --skip-build --root=%{buildroot}
142 %endif
143 %endif
144 %if %{with_python3}
145 %if 0%{?fedora} || 0%{?rhel} >= 8
146 %py3_install
147 %else
148 %{__python3} setup.py install --skip-build --root=%{buildroot}
149 %endif
150 %endif
152 %check
153 %if %{with_python2}
154 %{__python2} setup.py test
155 %endif
156 %if %{with_python3}
157 %{__python3} setup.py test
158 %endif
160 %if %{with_python2}
161 %files -n python2-libvirt
162 %doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/
163 %{python2_sitearch}/libvirt.py*
164 %{python2_sitearch}/libvirt_qemu.py*
165 %{python2_sitearch}/libvirt_lxc.py*
166 %{python2_sitearch}/libvirtmod*
167 %{python2_sitearch}/*egg-info
168 %endif
170 %if %{with_python3}
171 %files -n python3-libvirt
172 %doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/
173 %{python3_sitearch}/libvirt.py*
174 %{python3_sitearch}/libvirtaio.py*
175 %{python3_sitearch}/libvirt_qemu.py*
176 %{python3_sitearch}/libvirt_lxc.py*
177 %{python3_sitearch}/__pycache__/libvirt.cpython-*.py*
178 %{python3_sitearch}/__pycache__/libvirt_qemu.cpython-*.py*
179 %{python3_sitearch}/__pycache__/libvirt_lxc.cpython-*.py*
180 %{python3_sitearch}/__pycache__/libvirtaio.cpython-*.py*
181 %{python3_sitearch}/libvirtmod*
182 %{python3_sitearch}/*egg-info
183 %endif
185 %changelog