2f841ef
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
2f841ef
2f841ef
%global srcname Chameleon
2f841ef
2f841ef
Name:           python-chameleon
2f841ef
Version:        1.2.12
2f841ef
Release:        4%{?dist}
2f841ef
Summary:        XML-based template compiler
2f841ef
2f841ef
Group:          Development/Languages
2f841ef
License:        BSD
2f841ef
URL:            http://chameleon.repoze.org/
2f841ef
Source0:        http://pypi.python.org/packages/source/C/Chameleon/Chameleon-1.2.12.tar.gz
2f841ef
# setup.py specifies specific versions but newer versions can work as well.
2f841ef
# Loosen those deps up so we can run with the system packages installed
2f841ef
Patch0: python-chameleon-loosen-deps.patch
2f841ef
# Python2.7 changes the Excpetions that are raised by elementtree
2f841ef
Patch1: python-chameleon-py27.patch
2f841ef
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
2f841ef
2f841ef
BuildArch:      noarch
2f841ef
BuildRequires:  python2-devel
2f841ef
# For docs
2f841ef
BuildRequires: python-sphinx
2f841ef
# For tests to run
2f841ef
BuildRequires: python-setuptools
2f841ef
BuildRequires: python-lxml
2f841ef
BuildRequires: python-zope-interface
2f841ef
# These are reviewed but not yet in the Buildroot to build against
2f841ef
#BuildRequires: python-zope-i18n
2f841ef
#BuildRequires: python-zope-component 
2f841ef
2f841ef
%if 0%{?rhel} && 0%{?rhel} < 6
2f841ef
BuildRequires: python-elementtree
2f841ef
Requires: python-elementtree
2f841ef
%endif
2f841ef
2f841ef
Requires: python-setuptools
2f841ef
Requires: python-lxml
2f841ef
# These are optional dependencies.  Will add them once they're reviewed and in Fedora
2f841ef
#Requires: python-zope-i18n
2f841ef
#Requires: python-zope-component
2f841ef
2f841ef
2f841ef
%description
2f841ef
Chameleon is an XML attribute language template compiler. It comes with
2f841ef
implementations for the Zope Page Templates (ZPT) and Genshi templating
2f841ef
languages.
2f841ef
2f841ef
The engine compiles templates into Python byte-code. This results in
2f841ef
performance which is on average 10-15 times better than implementations which
2f841ef
use run-time interpretation.
2f841ef
2f841ef
%prep
2f841ef
%setup -q -n %{srcname}-%{version}
2f841ef
%patch0 -p1
2f841ef
%if 0%{?fedora} >= 14
2f841ef
# Elementree behaviour only changed in python-2.7
2f841ef
%patch1 -p1
2f841ef
%endif
2f841ef
2f841ef
%build
2f841ef
%{__python} setup.py build
2f841ef
2f841ef
PYTHONPATH=`pwd`/src make html
2f841ef
2f841ef
%install
2f841ef
rm -rf %{buildroot}
2f841ef
%{__python} setup.py install --skip-build --root %{buildroot}
2f841ef
2f841ef
# No need to ship docs and tests as part of the module
2f841ef
rm -rf %{buildroot}%{python_sitelib}/chameleon/docs
2f841ef
rm -rf  %{buildroot}%{python_sitelib}/chameleon/tests
2f841ef
# Data files for the tests
2f841ef
find %{buildroot}%{python_sitelib}/chameleon -name '*.txt' -exec rm \{\} \;
2f841ef
2f841ef
# Clean up the documentation
2f841ef
mv _build/html .
2f841ef
rm -rf html/.buildinfo
2f841ef
2f841ef
mv %{buildroot}%{python_sitelib}/chameleon/ast/COPYING COPYING.ast
2f841ef
2f841ef
%clean
2f841ef
rm -rf %{buildroot}
2f841ef
2f841ef
# We can enable these when the BuildRequires are satisfied
2f841ef
#check
2f841ef
#{__python} setup.py test
2f841ef
2f841ef
%files
2f841ef
%defattr(-,root,root,-)
2f841ef
%doc *.rst *.txt html COPYING.ast
2f841ef
%{_bindir}/*
2f841ef
%{python_sitelib}/*
2f841ef
2f841ef
2f841ef
%changelog
2f841ef
* Sat Sep 18 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 1.2.12-4
2f841ef
- Move COPYING file out of the ast directory and into docdir.
2f841ef
2f841ef
* Fri Sep 17 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 1.2.12-3
2f841ef
- Fix unittests on python-2.7.
2f841ef
2f841ef
* Thu Sep 16 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 1.2.12-2
2f841ef
- Add a patch so we can run with newer versions of the optional deps
2f841ef
2f841ef
* Wed Sep 15 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 1.2.12-1
2f841ef
- Initial package