Blob Blame History Raw
%if 0%{?rhel} && 0%{?rhel} <= 7
%global with_python3 0
%else
%global with_python3 1
%endif

%global modname tw2.core

Name:           python-tw2-core
Version:        2.2.3
Release:        10%{?dist}
Summary:        Web widget creation toolkit based on TurboGears widgets

Group:          Development/Languages
License:        MIT
URL:            http://toscawidgets.org
Source0:        http://pypi.python.org/packages/source/t/%{modname}/%{modname}-%{version}.tar.gz

# python-markupsafe is too old in rhel6.
Patch0:         python-tw2-core-escape_silent-is-too-new.patch

# fix unicode issues https://github.com/toscawidgets/tw2.core/pull/117
Patch1:         python-tw2-core-mako-unicode.patch

BuildArch:      noarch

# For building, generally
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
%if 0%{?rhel} && 0%{?rhel} <= 6
BuildRequires:  python-webob1.0 >= 0.9.7
%else
BuildRequires:  python2-webob >= 0.9.7
%endif
BuildRequires:  python2-simplejson >= 2.0
BuildRequires:  python2-decorator
BuildRequires:  python2-markupsafe
BuildRequires:  python2-speaklater
BuildRequires:  python2-paste-deploy
BuildRequires:  python2-six
BuildRequires:  python2-nine

# Specifically for the test suite
BuildRequires:  python2-unittest2
BuildRequires:  python2-nose
BuildRequires:  python2-coverage
BuildRequires:  python2-formencode
BuildRequires:  python2-webtest
BuildRequires:  python2-sieve

# Templating languages for the test suite
BuildRequires:  python2-mako
BuildRequires:  python2-genshi
BuildRequires:  python2-chameleon
BuildRequires:  python2-kajiki
BuildRequires:  python2-jinja2

%if 0%{?with_python3}
# General
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-webob >= 0.9.7
BuildRequires:  python3-simplejson >= 2.0
BuildRequires:  python3-decorator
BuildRequires:  python3-markupsafe
BuildRequires:  python3-speaklater
BuildRequires:  python3-paste-deploy
BuildRequires:  python3-six
BuildRequires:  python3-nine

# Specifically for the test suite
BuildRequires:  python3-unittest2
BuildRequires:  python3-nose
BuildRequires:  python3-coverage
BuildRequires:  python3-formencode
BuildRequires:  python3-webtest
BuildRequires:  python3-sieve

# Templating languages for the test suite
BuildRequires:  python3-mako
BuildRequires:  python3-genshi
BuildRequires:  python3-chameleon
BuildRequires:  python3-kajiki
BuildRequires:  python3-jinja2
%endif

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

%description

ToscaWidgets is a web widget toolkit for Python to aid in the creation,
packaging and distribution of common view elements normally used in the web.

The tw2.core package is lightweight and intended for run-time use only;
development tools are in tw2.devtools.


%package -n python2-tw2-core
Summary: %summary

# Runtime requirements
%if 0%{?rhel} && 0%{?rhel} <= 6
Requires:       python-ordereddict
Requires:       python-webob1.0 >= 0.9.7
%else
Requires:       python2-webob >= 0.9.7
%endif
Requires:       python2-simplejson >= 2.0
Requires:       python2-decorator
Requires:       python2-markupsafe
Requires:       python2-speaklater
Requires:       python2-paste-deploy
Requires:       python2-six
Requires:       python2-nine

%{?python_provide:%python_provide python2-tw2-core}


%description -n python2-tw2-core
ToscaWidgets is a web widget toolkit for Python to aid in the creation,
packaging and distribution of common view elements normally used in the web.

The tw2.core package is lightweight and intended for run-time use only;
development tools are in tw2.devtools.

This package contains the python2 version of the toolkit

%if 0%{?with_python3}
%package -n python3-tw2-core
Summary: Web widget creation toolkit based on TurboGears widgets
Requires: python3-webob >= 0.9.7
Requires: python3-simplejson >= 2.0
Requires: python3-decorator
Requires: python3-markupsafe
Requires: python3-speaklater
Requires: python3-paste-deploy
Requires: python3-six
Requires: python3-nine

%{?python_provide:%python_provide python3-tw2-core}

%description -n python3-tw2-core
ToscaWidgets is a web widget toolkit for Python to aid in the creation,
packaging and distribution of common view elements normally used in the web.

The tw2.core package is lightweight and intended for run-time use only;
development tools are in tw2.devtools.

This package contains the python3 version of the toolkit
%endif

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

%if 0%{?rhel} && 0%{?rhel} <= 6
%patch0 -p1
# Old mako in el6 doesn't have "loop.last"
sed -i 's/for c in w.children/for i, c in enumerate(w.children)/' tw2/core/templates/display_children.mak
sed -i 's/loop.last/(i == len(w.children) - 1)/' tw2/core/templates/display_children.mak
%endif

%patch1 -p1

%if 0%{?rhel} && 0%{?rhel} <= 6
# Make sure that epel/rhel picks up the correct version of webob
awk 'NR==1{print "import __main__; __main__.__requires__ = __requires__ = [\"WebOb>=1.0\"]; import pkg_resources"}1' setup.py > setup.py.tmp
mv setup.py.tmp setup.py

# Remove all the fancy nosetests configuration for older python
rm setup.cfg

%endif

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

%build
%{__python2} setup.py build

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

%install
%{__python2} setup.py install --skip-build \
    --install-data=%{_datadir} --root=%{buildroot}

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

%check
PYTHONPATH=$(pwd) %{__python2} setup.py test

%if 0%{?with_python3}
pushd %{py3dir}
PYTHONPATH=$(pwd) %{__python3} setup.py test
popd
%endif # with_python3

%files -n python2-tw2-core
%{!?_licensedir:%global license %%doc}
%license LICENSE.txt
%doc README.rst
%{python2_sitelib}/tw2
%{python2_sitelib}/%{modname}-%{version}*

%if 0%{?with_python3}
%files -n python3-tw2-core
%{!?_licensedir:%global license %%doc}
%license LICENSE.txt
%doc README.rst
%{python3_sitelib}/tw2
%{python3_sitelib}/%{modname}-%{version}*
%endif

%changelog
* Wed Feb 28 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.2.3-10
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.2.3-9
- Escape macros in %%changelog

* Tue Oct 17 2017 Petr Viktorin <pviktori@redhat.com> - 2.2.3-8
- Python 2 binary package renamed to python2-tw2-core

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.3-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 2.2.3-5
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.3-4
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Jan  6 2016 Toshio Kuratomi <toshio@fedoraproject.org> - 2.2.3-2
- Python3 subpackage

* Fri Dec 11 2015 Ralph Bean <rbean@redhat.com> - 2.2.3-1
- new version

* Fri Oct 16 2015 Ralph Bean <rbean@redhat.com> - 2.2.2-3
- Apply patch from upstream to fix unicode issues with mako.

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

* Fri Feb 20 2015 Ralph Bean <rbean@redhat.com> - 2.2.2-1
- new version

* Fri Feb 20 2015 Ralph Bean <rbean@redhat.com> - 2.2.2-1
- new version
- Further fix rhel6 conditionals.

* Thu Nov 13 2014 Ralph Bean <rbean@redhat.com> - 2.2.1.1-5
- Spec bump to deal with ridiculous epel7 merge.  ;(

* Wed Nov 12 2014 Ralph Bean <rbean@redhat.com> - 2.2.1.1-3
- Update rhel6 conditionals.

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

* Tue Jan 28 2014 Ralph Bean <rbean@redhat.com> - 2.2.1.1-1
- Latest upstream.

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

* Thu Feb 28 2013 Ralph Bean <rbean@redhat.com> - 2.1.5-3
- Patch for python-markupsafe usage on el6.

* Thu Feb 28 2013 Ralph Bean <rbean@redhat.com> - 2.1.5-2
- Added requirement on python-markupsafe.
- Added el6 conditional requirement on python-ordereddict.

* Fri Feb 22 2013 Ralph Bean <rbean@redhat.com> - 2.1.5-1
- Latest upstream

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

* Mon Aug 06 2012 Ralph Bean <rbean@redhat.com> - 2.0.5-4
- Test change for fedmsg hook.

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

* Thu Jun 07 2012 Ralph Bean <rbean@redhat.com> - 2.0.5-2
- Correct directory ownership.

* Tue Apr 24 2012 Ralph Bean <rbean@redhat.com> - 2.0.5-1
- Packaged latest version of tw2.core which fixes streaming WSGI compliance.
- Removed defattr in the files section.
- Removed clean section.  Not supporting EPEL5.
- Removed references to buildroot.

* Mon Apr 16 2012 Ralph Bean <rbean@redhat.com> - 2.0.4-1
- Packaged latest version of tw2.core which fixes tests on py2.6.
- Added awk line to make sure pkg_resources picks up the right WebOb on el6
- Added dependency on python-unittest2

* Wed Apr 11 2012 Ralph Bean <rbean@redhat.com> - 2.0.3-1
- Packaged the latest release of tw2.core.
- Fixed rpmlint - python-bytecode-without-source
- Fixed rpmlint - non-executable-script

* Tue Apr 10 2012 Ralph Bean <rbean@redhat.com> - 2.0.2-1
- Packaged the latest release of tw2.core.
- Added the %%{?dist} macro to Release:

* Wed Apr 04 2012 Ralph Bean <rbean@redhat.com> - 2.0.1-1
- Update for latest tw2.core release.

* Thu Jun 16 2011 Luke Macken <lmacken@redhat.com> - 2.0-0.1.b4
- Initial package