Conditionally declare and clean buildroot to support el5

- Fix declaration of Python macro, and make it apply only to el5
(cherry picked from commit 3ed61f7113)
This commit is contained in:
Michel Alexandre Salim 2013-03-18 09:47:16 +07:00
parent 26b359d213
commit add92bda5c
1 changed files with 14 additions and 2 deletions

View File

@ -1,7 +1,9 @@
%if 0%{?fedora} > 12 || 0%{?rhel} > 6
%global with_python3 1
%else
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif
%if 0%{?el5}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))")}
%endif
%global short_name psutil
@ -27,6 +29,10 @@ BuildRequires: python2-devel
BuildRequires: python3-devel
%endif
%if 0%{?el5}
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
%endif
%description
psutil is a module providing an interface for retrieving information on all
running processes and system utilization (CPU, memory, disks, network, users) in
@ -76,6 +82,10 @@ popd
%install
%if 0%{?el5}
rm -rf $RPM_BUILD_ROOT
%endif
%{__python} setup.py install \
--skip-build \
--root $RPM_BUILD_ROOT
@ -98,7 +108,9 @@ chmod 0755 $RPM_BUILD_ROOT%{python3_sitearch}/*.so
%files
%doc CREDITS HISTORY LICENSE README
%{python_sitearch}/%{short_name}/
%if ! 0%{?el5}
%{python_sitearch}/*.egg-info
%endif
%{python_sitearch}/*.so