Modernize spec

- Fix python3 package file ownership
- Run python3 tests
This commit is contained in:
Orion Poplawski 2016-02-02 18:27:38 -07:00
parent 5c977766b5
commit f05ffc9867

View File

@ -1,19 +1,15 @@
%if 0%{?fedora}
%global with_python3 1
%else
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%endif
Name: python-decorator
Version: 4.0.6
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Module to simplify usage of decorators
Group: Development/Languages
License: BSD
URL: http://pypi.python.org/pypi/decorator/
Source0: http://pypi.python.org/packages/source/d/decorator/decorator-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python2-devel
@ -21,8 +17,9 @@ BuildRequires: python-setuptools
BuildRequires: python-nose
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-nose
%endif
%description
@ -31,10 +28,20 @@ the average programmer, and to popularize decorators usage giving examples
of useful decorators, such as memoize, tracing, redirecting_stdout, locked,
etc. The core of this module is a decorator factory called decorator.
%package -n python2-decorator
Summary: Module to simplify usage of decorators in python2
%{?python_provide:%python_provide python2-decorator}
%description -n python2-decorator
The aim of the decorator module is to simplify the usage of decorators for
the average programmer, and to popularize decorators usage giving examples
of useful decorators, such as memoize, tracing, redirecting_stdout, locked,
etc. The core of this module is a decorator factory called decorator.
%if 0%{?with_python3}
%package -n python3-decorator
Summary: Module to simplify usage of decorators in python3
Group: Development/Languages
%{?python_provide:%python_provide python3-decorator}
%description -n python3-decorator
The aim of the decorator module is to simplify the usage of decorators for
@ -49,65 +56,51 @@ etc. The core of this module is a decorator factory called decorator.
chmod a-x *.py
%{__sed} -i 's/\r//' docs/README.rst
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3
%build
%{__python} setup.py build
%{py2_build}
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%{py3_build}
%endif # with_python3
%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
%{py2_install}
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
popd
%{py3_install}
%endif # with_python3
%clean
rm -rf $RPM_BUILD_ROOT
%check
# Until we get the python-multiprocessing backport packaged
%if 0%{?fedora} || 0%{?rhel} > 5
nosetests --with-doctest
%endif
nosetests-%{python2_version} --with-doctest
# nose is not Python3 ready yet
%if 0%{?with_python3}
pushd %{py3dir}
nosetests --with-doctest
popd
nosetests-%{python3_version} --with-doctest
%endif # with_python3
%files
%defattr(-,root,root,-)
%files -n python2-decorator
%doc docs/README.rst CHANGES.txt documentation.pdf
%license LICENSE.txt
%{python_sitelib}/*
%{python2_sitelib}/*
%if 0%{?with_python3}
%files -n python3-decorator
%defattr(-,root,root,-)
%doc docs/README.rst CHANGES.txt documentation.pdf
%license LICENSE.txt
%{python3_sitelib}/*
%{python3_sitelib}/decorator.py
%{python3_sitelib}/decorator-*.egg-info/
%{python3_sitelib}/__pycache__/*
%endif # with_python3
%changelog
* Tue Feb 2 2016 Orion Poplawski <orion@cora.nwra.com> - 4.0.6-2
- Modernize spec
- Fix python3 package file ownership
- Run python3 tests
* Fri Dec 11 2015 Ralph Bean <rbean@redhat.com> - 4.0.6-1
- new version