93ac28d
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
93ac28d
93ac28d
Name:           python-py
93ac28d
Version:        0.9.2
e7add50
Release:        7%{?dist}
93ac28d
Summary:        Innovative python library containing py.test, greenlets and other niceties
93ac28d
Group:          Development/Languages
93ac28d
License:        MIT and LGPLv2+ and Public Domain and BSD and Python
93ac28d
#               - main package: MIT, except:
93ac28d
#                 - test/rsession/webdata/json.py: LPGLv2+
93ac28d
#                 - doc/style.css: Public Domain
93ac28d
#                 - test/web/post_multipart.py: Python 
93ac28d
#                   (see http://code.activestate.com/help/terms)
93ac28d
#                 - compat/textwrap.py: Python
93ac28d
#                 - compat/subprocess.py: Python
93ac28d
#                 - compat/doctest.py: Public Domain
93ac28d
#                 - compat/optparse.py: BSD
93ac28d
#               Note that all but the doctest compat files are removed
93ac28d
#               in the prep stage.
93ac28d
URL:            http://codespeak.net/py/dist/
93ac28d
Source:         http://pypi.python.org/packages/source/p/py/py-%{version}.tar.gz
93ac28d
# r58576 from trunk
93ac28d
Patch0:         py-0.9.2-fix-test-cache.patch
93ac28d
# r60277 from trunk
93ac28d
Patch1:         py-0.9.2-svn15.patch
93ac28d
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
93ac28d
BuildRequires:  python-devel
93ac28d
BuildRequires:  python-setuptools-devel
93ac28d
# needed by the testsuite
93ac28d
BuildRequires:  subversion
93ac28d
BuildRequires:  python-docutils
93ac28d
93ac28d
%define doctarget %{buildroot}%{_docdir}/%{name}-%{version}
93ac28d
93ac28d
%ifarch ppc ppc64
93ac28d
# until the greenlet issue can be fixed
93ac28d
%define debug_package %{nil}
93ac28d
%endif
93ac28d
93ac28d
93ac28d
%description
93ac28d
The py lib aims at supporting a decent development process addressing
93ac28d
deployment, versioning, testing and documentation perspectives.
93ac28d
93ac28d
93ac28d
%prep
93ac28d
%setup -q -n py-%{version}
93ac28d
%patch0 -p1 -b .test-cache
93ac28d
%patch1 -p0 -b .svn
93ac28d
93ac28d
# remove the compatibility modules, and use system modules instead
93ac28d
for module in doctest optparse textwrap subprocess ; do
93ac28d
    rm py/compat/$module.py
93ac28d
    echo "from $module import *" > py/compat/system_$module.py
93ac28d
    sed -i py/__init__.py -e "s,compat/$module.py,compat/system_$module.py,"
93ac28d
done
93ac28d
93ac28d
93ac28d
%build
93ac28d
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
93ac28d
93ac28d
93ac28d
%install
93ac28d
rm -rf %{buildroot}
93ac28d
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
93ac28d
93ac28d
# remove shebangs and fix permissions
93ac28d
find %{buildroot}%{python_sitearch} \( -name '*.py' -o -name 'py.*' \) \
93ac28d
   -exec sed -i '1{/^#!/d}' {} \; \
93ac28d
   -exec chmod u=rw,go=r {} \;
93ac28d
93ac28d
# move and cleanup docs
93ac28d
mkdir -p %{doctarget}
93ac28d
mv %{buildroot}%{python_sitearch}/py/LICENSE %{doctarget}
93ac28d
mv %{buildroot}%{python_sitearch}/py/doc/* %{doctarget}
93ac28d
rm %{doctarget}/*.py*
93ac28d
rmdir %{buildroot}%{python_sitearch}/py/doc
93ac28d
mv %{buildroot}%{python_sitearch}/py/apigen/todo.txt %{doctarget}/todo_apigen.txt
93ac28d
mv %{buildroot}%{python_sitearch}/py/apigen/todo-apigen.txt %{doctarget}/todo-apigen_apigen.txt
93ac28d
mv %{buildroot}%{python_sitearch}/py/compat/LICENSE %{doctarget}/LICENSE_compat
93ac28d
mv %{buildroot}%{python_sitearch}/py/execnet/NOTES %{doctarget}/NOTES_execnet
93ac28d
mv %{buildroot}%{python_sitearch}/py/path/gateway/TODO.txt %{doctarget}/TODO_path_gateway.txt
93ac28d
mv %{buildroot}%{python_sitearch}/py/path/svn/quoting.txt %{doctarget}/quoting_path_svn.txt
93ac28d
mv %{buildroot}%{python_sitearch}/py/c-extension/greenlet/README.txt %{doctarget}/RADME_greenlet.txt
93ac28d
93ac28d
# remove (most) files only used by the testsuite
93ac28d
find %{buildroot}%{python_sitearch} -type d -name testing -prune -exec rm -r {} \;
93ac28d
find %{buildroot}%{python_sitearch} -name 'conftest.py*' -exec rm {} \;
93ac28d
rm -r %{buildroot}%{python_sitearch}/py/io/test
93ac28d
93ac28d
# remove this and that
93ac28d
rm %{buildroot}%{python_sitearch}/py/env.cmd
93ac28d
rm -r %{buildroot}%{python_sitearch}/py/bin
93ac28d
rm %{buildroot}%{python_sitearch}/py/c-extension/greenlet/*.h
93ac28d
rm %{buildroot}%{python_sitearch}/py/c-extension/greenlet/*.c
93ac28d
rm %{buildroot}%{python_sitearch}/py/c-extension/greenlet/setup.*
93ac28d
rm %{buildroot}%{python_sitearch}/py/c-extension/greenlet/test_*
93ac28d
93ac28d
%ifarch ppc ppc64
93ac28d
cp -p py/c-extension/greenlet/dummy_greenlet.py \
93ac28d
   %{buildroot}%{python_sitearch}/py/c-extension/greenlet/greenlet.py
93ac28d
rm %{buildroot}%{python_sitearch}/py/c-extension/greenlet/greenlet.so
93ac28d
cat << \EOF > %{doctarget}/README.greenlet.fedora
93ac28d
The native py.magic.greenlet code has been replaced by
93ac28d
dummy_greenlet.py on ppc and ppc64 for this package because it
93ac28d
reproducibly segfaults.
93ac28d
%endif
93ac28d
93ac28d
93ac28d
%check
93ac28d
93ac28d
# on ppc, use dummy greenlets also for the tests
93ac28d
%ifarch ppc ppc64
93ac28d
cp -p py/c-extension/greenlet/dummy_greenlet.py \
93ac28d
   py/c-extension/greenlet/greenlet.py
93ac28d
rm py/c-extension/greenlet/*.{c,h}
93ac28d
%endif
93ac28d
93ac28d
# see pylib issue67
93ac28d
rm py/doc/apigen.txt
93ac28d
sed -i '/apigen/d' py/doc/index.txt
93ac28d
93ac28d
PYTHONPATH=$(pwd)/py %{__python} py/bin/py.test py
93ac28d
93ac28d
93ac28d
%clean
93ac28d
rm -rf %{buildroot}
93ac28d
93ac28d
93ac28d
%files
93ac28d
%defattr(-,root,root,-)
93ac28d
%{_bindir}/py.*
93ac28d
%{python_sitearch}/*
93ac28d
%{_docdir}/%{name}-%{version}
93ac28d
93ac28d
93ac28d
%changelog
e7add50
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.2-7
e7add50
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
e7add50
93ac28d
* Wed Jan 14 2009 Thomas Moschny <thomas.moschny@gmx.de> - 0.9.2-6
93ac28d
- Use system doctest module again, as this wasn't the real cause of
93ac28d
  the test failure. Instead, remove the failing test for now.
93ac28d
93ac28d
* Fri Dec 12 2008 Thomas Moschny <thomas.moschny@gmx.de> - 0.9.2-5
93ac28d
- Add patch from trunk fixing a subversion 1.5 problem (pylib
93ac28d
  issue66).
93ac28d
- Don't replace doctest compat module (pylib issue67).
93ac28d
93ac28d
* Fri Nov 21 2008 Thomas Moschny <thomas.moschny@gmx.de> - 0.9.2-4
93ac28d
- Use dummy_greenlet on ppc and ppc64.
93ac28d
93ac28d
* Tue Oct  7 2008 Thomas Moschny <thomas.moschny@gmx.de> - 0.9.2-3
93ac28d
- Replace compat modules by stubs using the system modules instead.
93ac28d
- Add patch from trunk fixing a timing issue in the tests.
93ac28d
93ac28d
* Tue Sep 30 2008 Thomas Moschny <thomas.moschny@gmx.de> - 0.9.2-2
93ac28d
- Update license information.
93ac28d
- Fix the tests.
93ac28d
93ac28d
* Sun Sep  7 2008 Thomas Moschny <thomas.moschny@gmx.de> - 0.9.2-1
93ac28d
- Update to 0.9.2.
93ac28d
- Upstream now uses setuptools and installs to %%{python_sitearch}.
93ac28d
- Remove %%{srcname} macro.
93ac28d
- More detailed information about licenses.
93ac28d
93ac28d
* Wed Aug 21 2008 Thomas Moschny <thomas.moschny@gmx.de> - 0.9.1-1
93ac28d
- New package.