Blob Blame History Raw
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}

%global srcname Chameleon

Name:           python-chameleon
Version:        1.2.12
Release:        5%{?dist}
Summary:        XML-based template compiler

Group:          Development/Languages
License:        BSD
URL:            http://chameleon.repoze.org/
Source0:        http://pypi.python.org/packages/source/C/Chameleon/Chameleon-1.2.12.tar.gz
# setup.py specifies specific versions but newer versions can work as well.
# Loosen those deps up so we can run with the system packages installed
Patch0: python-chameleon-loosen-deps.patch
# Python2.7 changes the Excpetions that are raised by elementtree
Patch1: python-chameleon-py27.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildArch:      noarch
BuildRequires:  python2-devel
# For docs
BuildRequires: python-sphinx
# For tests to run
BuildRequires: python-setuptools
BuildRequires: python-lxml
BuildRequires: python-zope-interface
# These are reviewed but not yet in the Buildroot to build against
#BuildRequires: python-zope-i18n
#BuildRequires: python-zope-component 

%if 0%{?rhel} && 0%{?rhel} < 6
BuildRequires: python-elementtree
Requires: python-elementtree
%endif

Requires: python-setuptools
Requires: python-lxml
# These are optional dependencies.  Will add them once they're reviewed and in Fedora
#Requires: python-zope-i18n
#Requires: python-zope-component


%description
Chameleon is an XML attribute language template compiler. It comes with
implementations for the Zope Page Templates (ZPT) and Genshi templating
languages.

The engine compiles templates into Python byte-code. This results in
performance which is on average 10-15 times better than implementations which
use run-time interpretation.

%prep
%setup -q -n %{srcname}-%{version}
%patch0 -p1
%if 0%{?fedora} >= 14
# Elementree behaviour only changed in python-2.7
%patch1 -p1
%endif

%build
%{__python} setup.py build

PYTHONPATH=`pwd`/src make html

%install
rm -rf %{buildroot}
%{__python} setup.py install --skip-build --root %{buildroot}

# No need to ship docs and tests as part of the module
rm -rf %{buildroot}%{python_sitelib}/chameleon/docs
rm -rf  %{buildroot}%{python_sitelib}/chameleon/tests
# Data files for the tests
find %{buildroot}%{python_sitelib}/chameleon -name '*.txt' -exec rm \{\} \;

# Clean up the documentation
mv _build/html .
rm -rf html/.buildinfo

mv %{buildroot}%{python_sitelib}/chameleon/ast/COPYING COPYING.ast

%clean
rm -rf %{buildroot}

# We can enable these when the BuildRequires are satisfied
#check
#{__python} setup.py test

%files
%defattr(-,root,root,-)
%doc *.rst *.txt html COPYING.ast
%{_bindir}/*
%{python_sitelib}/*


%changelog
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.12-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Sat Sep 18 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 1.2.12-4
- Move COPYING file out of the ast directory and into docdir.

* Fri Sep 17 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 1.2.12-3
- Fix unittests on python-2.7.

* Thu Sep 16 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 1.2.12-2
- Add a patch so we can run with newer versions of the optional deps

* Wed Sep 15 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 1.2.12-1
- Initial package