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} %if 0%{?fedora}
%global with_python3 1 %global with_python3 1
%else
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%endif %endif
Name: python-decorator Name: python-decorator
Version: 4.0.6 Version: 4.0.6
Release: 1%{?dist} Release: 2%{?dist}
Summary: Module to simplify usage of decorators Summary: Module to simplify usage of decorators
Group: Development/Languages
License: BSD License: BSD
URL: http://pypi.python.org/pypi/decorator/ URL: http://pypi.python.org/pypi/decorator/
Source0: http://pypi.python.org/packages/source/d/decorator/decorator-%{version}.tar.gz Source0: http://pypi.python.org/packages/source/d/decorator/decorator-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch BuildArch: noarch
BuildRequires: python2-devel BuildRequires: python2-devel
@ -23,6 +19,7 @@ BuildRequires: python-nose
%if 0%{?with_python3} %if 0%{?with_python3}
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
BuildRequires: python3-nose
%endif %endif
%description %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, of useful decorators, such as memoize, tracing, redirecting_stdout, locked,
etc. The core of this module is a decorator factory called decorator. 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} %if 0%{?with_python3}
%package -n python3-decorator %package -n python3-decorator
Summary: Module to simplify usage of decorators in python3 Summary: Module to simplify usage of decorators in python3
Group: Development/Languages %{?python_provide:%python_provide python3-decorator}
%description -n python3-decorator %description -n python3-decorator
The aim of the decorator module is to simplify the usage of decorators for 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 chmod a-x *.py
%{__sed} -i 's/\r//' docs/README.rst %{__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 %build
%{__python} setup.py build %{py2_build}
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} %{py3_build}
%{__python3} setup.py build
popd
%endif # with_python3 %endif # with_python3
%install %install
rm -rf $RPM_BUILD_ROOT %{py2_install}
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} %{py3_install}
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
popd
%endif # with_python3 %endif # with_python3
%clean
rm -rf $RPM_BUILD_ROOT
%check %check
# Until we get the python-multiprocessing backport packaged nosetests-%{python2_version} --with-doctest
%if 0%{?fedora} || 0%{?rhel} > 5
nosetests --with-doctest
%endif
# nose is not Python3 ready yet
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} nosetests-%{python3_version} --with-doctest
nosetests --with-doctest
popd
%endif # with_python3 %endif # with_python3
%files %files -n python2-decorator
%defattr(-,root,root,-)
%doc docs/README.rst CHANGES.txt documentation.pdf %doc docs/README.rst CHANGES.txt documentation.pdf
%license LICENSE.txt %license LICENSE.txt
%{python_sitelib}/* %{python2_sitelib}/*
%if 0%{?with_python3} %if 0%{?with_python3}
%files -n python3-decorator %files -n python3-decorator
%defattr(-,root,root,-)
%doc docs/README.rst CHANGES.txt documentation.pdf %doc docs/README.rst CHANGES.txt documentation.pdf
%license LICENSE.txt %license LICENSE.txt
%{python3_sitelib}/* %{python3_sitelib}/decorator.py
%{python3_sitelib}/decorator-*.egg-info/
%{python3_sitelib}/__pycache__/*
%endif # with_python3 %endif # with_python3
%changelog %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 * Fri Dec 11 2015 Ralph Bean <rbean@redhat.com> - 4.0.6-1
- new version - new version