diff --git a/python-decorator.spec b/python-decorator.spec index 9382f73..a3bbb5c 100644 --- a/python-decorator.spec +++ b/python-decorator.spec @@ -1,6 +1,6 @@ # sitelib for noarch packages, sitearch for others (remove the unneeded one) %if 0%{?fedora} > 12 || 0%{?rhel} > 6 -%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 @@ -25,25 +25,62 @@ BuildRequires: python-setuptools %endif BuildRequires: python-nose +%if 0%{?with_python3} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +%endif + %description 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 + +%description -n python3-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. +%endif # if with_python3 + %prep %setup -q -n decorator-%{version} chmod a-x *.txt *.py %{__sed} -i 's/\r//' README.txt +%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 +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py build +popd +%endif # with_python3 + + %install rm -rf $RPM_BUILD_ROOT %{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT +popd +%endif # with_python3 + %clean rm -rf $RPM_BUILD_ROOT @@ -53,15 +90,31 @@ rm -rf $RPM_BUILD_ROOT nosetests --with-doctest -e documentation3 %endif +# nose is not Python3 ready yet +%if 0%{?with_python3} +pushd %{py3dir} +#nosetests --with-doctest -e documentation +popd +%endif # with_python3 + %files %defattr(-,root,root,-) %doc *.txt %{python_sitelib}/* +%if 0%{?with_python3} +%files -n python3-decorator +%defattr(-,root,root,-) +%doc *.txt +%{python3_sitelib}/* +%endif # with_python3 + + %changelog * Wed Jun 30 2010 Toshio Kuratomi - 3.2.0-1 - Minor cleanups - Upgrade to 3.2.0 +- Add python3 subpackage * Tue Oct 6 2009 Toshio Kuratomi - 3.1.2-2 - Really include the new source tarball