# Tests by default. No tests: rpm -ba --define 'dotests 0' *.spec %{!?dotests: %define dotests 1} %define name python3-decorator %define srcname decorator %define version 4.4.1 %define release 1 %define is_python %(test -e /usr/bin/python3_32 && echo 1 || echo 0) %if %{is_python} %define python_sitelib %(python3_32 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif %define _libdir64 %{_prefix}/lib64 %define is_python_64 %(test -e /usr/bin/python3 && echo 1 || echo 0) %if %{is_python_64} %define python_sitelib64 %(python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif Summary: Better living through Python with decorators Name: %{name} Version: %{version} Release: %{release} Source0: %{srcname}-%{version}.tar.gz License: BSD License Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildArch: noarch Vendor: Michele Simionato Url: http://pypi.python.org/pypi/decorator BuildRequires: python, python-devel Requires: python %description Python decorators are an interesting example of why syntactic sugar matters. In principle, their introduction in Python 2.4 changed nothing, since they do not provide any new functionality which was not already present in the language. In practice, their introduction has significantly changed the way we structure our programs in Python. I believe the change is for the best, and that decorators are a great idea since: decorators help reducing boilerplate code; decorators help separation of concerns; decorators enhance readability and maintenability; decorators are explicit. Still, as of now, writing custom decorators correctly requires some experience and it is not as easy as it could be. For instance, typical implementations of decorators involve nested functions, and we all know that flat is better than nested. The aim of the decorator module it to simplify the usage of decorators for the average programmer, and to popularize decorators by showing various non-trivial examples. Of course, as all techniques, decorators can be abused (I have seen that) and you should not try to solve every problem with a decorator, just because you can. You may find the source code for all the examples discussed here in the documentation.py file, which contains this documentation in the form of doctests. %prep %setup -q -n %{srcname}-%{version} %build export OBJECT_MODE=64 python3 setup.py build if [ "%{dotests}" == 1 ] then python3 setup.py test fi %install [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT python3 setup.py install --skip-build --root ${RPM_BUILD_ROOT} %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc PKG-INFO README.rst %{python_sitelib}/decorator* %changelog * Fri Dec 20 2019 Harshita Jain - 4.4.1-1 - Update to latest version - Build with python3 * Thu Sep 21 2017 Ravi Hirekurabar -4.1.2 - Updated to 4.1.2 * Thu Sep 11 2013 Tristan Delhalle - 3.4.0-3 - include egg-info * Thu Jun 10 2013 Tristan Delhalle - 3.4.0-2 - generate with better python * Thu May 16 2013 Tristan Delhalle - 3.4.0-1 - first version for AIX V6.1 and higher