Blob Blame History Raw
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2:        %global __python2 /usr/bin/python2}
%{!?python2_sitelib:  %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

%if 0%{?fedora}
%global with_python3 1
%endif

%global srcname Chameleon

Name:           python-chameleon
Version:        2.16
Release:        2%{?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-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python2-devel
# For docs
BuildRequires:  python-sphinx
# For tests to run
BuildRequires:  python-setuptools
BuildRequires:  python-lxml
BuildRequires:  python-zope-interface

%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-sphinx
BuildRequires:  python3-setuptools
BuildRequires:  python3-lxml
BuildRequires:  python3-zope-interface
%endif

%if 0%{?rhel} && 0%{?rhel} <= 6
BuildRequires:  python-unittest2
%endif

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

Requires: python-setuptools
Requires: python-zope-interface
Requires: python-lxml

%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.

%if 0%{?with_python3}
%package -n python3-chameleon
Summary:        XML-based template compiler
Group:          Development/Languages

Requires:   python3-setuptools
Requires:   python3-zope-interface
Requires:   python3-lxml

%description -n python3-chameleon
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.
%endif

%prep
%setup -q -n %{srcname}-%{version}

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif

%{__python2} setup.py build

PYTHONPATH=`pwd`/src make html

%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root=%{buildroot}
popd
%endif

%{__python2} setup.py install --skip-build --root %{buildroot}

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

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

%check
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif

%{__python2} setup.py test

%files
%doc *.rst *.txt docs html
%{python2_sitelib}/chameleon/
%{python2_sitelib}/Chameleon-%{version}*

%if 0%{?with_python3}
%files -n python3-chameleon
%doc *.rst *.txt docs html
%{python3_sitelib}/chameleon/
%{python3_sitelib}/Chameleon-%{version}*
%endif

%changelog
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.16-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Wed Aug 20 2014 Ralph Bean <rbean@redhat.com> - 2.16-1
- Latest upstream.
- Modernize python2 macros.

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.15-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 14 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 2.15-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Fri Apr 11 2014 Ralph Bean <rbean@redhat.com> - 2.15-1
- Latest upstream.

* Fri Jan 17 2014 Ralph Bean <rbean@redhat.com> - 2.11-4
- Add dependency on ordereddict for el6.

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.11-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Wed Jan 16 2013 Ralph Bean <rbean@redhat.com> - 2.11-1
- Latest upstream version.
- More specific file/dir ownership.
- Removed unnecessary buildroot.
- Removed unnecessary defattr.
- Removed unnecessary clean section.
- Packaging a python3 subpackage.

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Dec 13 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 2.7.0-1
- New upstream release

* Thu Nov 10 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 2.5.3-1.1
- Fix to build on RHEL6

* Thu Nov 10 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 2.5.3-1
- New upstream release

* Mon Oct 3 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 2.5.1-1
- New upstream release

* Sun Aug 21 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 2.3.8-1
- New upstream release

* Thu Aug 18 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 2.3.6-1
- New upstream release

* Wed Aug 10 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 2.2-1
- New upstream release

* Fri Jul 15 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 2.0-1
- New upstream release
- This release removes the genshi-like syntax support -- F17+, only

* 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