Modernize the specfile

- Remove code for old unsupported EL/Fedora versions
- Use standard macros for calling Python's setup.py
- Remove BuildRoot declaration
This commit is contained in:
Petr Viktorin 2017-10-18 17:06:36 +02:00
parent a1c6ff72fe
commit 567c4cb1c3

View File

@ -2,11 +2,6 @@
%global with_python3 1 %global with_python3 1
%endif %endif
%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
Name: python-urwid Name: python-urwid
Version: 1.3.0 Version: 1.3.0
Release: 11%{?dist} Release: 11%{?dist}
@ -23,12 +18,11 @@ Source0: http://excess.org/urwid/urwid-%{version}.tar.gz
Patch0: py2-skip-tests-interrupted-syscall.patch Patch0: py2-skip-tests-interrupted-syscall.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
BuildRequires: python2-devel BuildRequires: python2-devel
BuildRequires: python-setuptools BuildRequires: python2-setuptools
BuildRequires: python-twisted-core BuildRequires: python2-twisted
BuildRequires: pygobject2 BuildRequires: pygobject2
BuildRequires: python-test BuildRequires: python2-test
# needed by selftest suite for test.support # needed by selftest suite for test.support
%if 0%{?with_python3} %if 0%{?with_python3}
@ -83,11 +77,11 @@ cp -a . %{py3dir}
%endif # with_python3 %endif # with_python3
%build %build
CFLAGS="%{optflags}" %{__python} setup.py build %py2_build
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} pushd %{py3dir}
%{__python3} setup.py build %py3_build
popd popd
%endif # with_python3 %endif # with_python3
@ -98,14 +92,14 @@ rm -rf %{buildroot}
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot} %py3_install
popd popd
%endif # with_python3 %endif # with_python3
%{__python} setup.py install --skip-build --no-compile --root %{buildroot} %py2_install
%check %check
python setup.py test %{__python2} setup.py test
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} pushd %{py3dir}