Blob Blame Raw
%global mod_name WTForms
%if 0%{?fedora} > 12
%global with_python3 1
%endif

Name:           python-wtforms
Version:        2.0
Release:        7%{?dist}
Summary:        Forms validation and rendering library for python

Group:          Development/Libraries
License:        BSD
URL:            http://wtforms.simplecodes.com/
Source0:        http://pypi.python.org/packages/source/W/%{mod_name}/%{mod_name}-%{version}.zip

# Submitted upstream at https://github.com/wtforms/wtforms/pull/143
Patch0:         143.patch

BuildArch:      noarch
BuildRequires:  python-devel
BuildRequires:  python-setuptools
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
%endif

%description
With wtforms, your form field HTML can be generated for you. 
This allows you to maintain separation of code and presentation, 
and keep those messy parameters out of your python code.

%if 0%{?with_python3}
%package -n python3-wtforms
Summary:        Forms validation and rendering library for python

%description -n python3-wtforms
With wtforms, your form field HTML can be generated for you. 
This allows you to maintain separation of code and presentation, 
and keep those messy parameters out of your python code.
%endif


%prep
%setup -q -n %{mod_name}-%{version}
%patch0 -p1
sed -i "s|\r||g" docs/html/_sources/index.txt
sed -i "s|\r||g" docs/conf.py
sed -i "s|\r||g" docs/Makefile
sed -i "s|\r||g" docs/index.rst
sed -i "s|\r||g" docs/html/_static/jquery.js
rm -f docs/html/.buildinfo

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

%build
%{__python2} setup.py build

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

%install
%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT

mkdir -p %{buildroot}/%{_datadir}
mv %{buildroot}/%{python_sitelib}/wtforms/locale %{buildroot}%{_datadir}
find %{buildroot}%{_datadir}/locale -name '*.po*' -delete

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_ROOT/%{python3_sitelib}/wtforms/locale
popd
%endif

%find_lang wtforms

%files -f wtforms.lang
%doc docs/ LICENSE.txt PKG-INFO
%{python_sitelib}/*.egg-info
%{python_sitelib}/wtforms/

%if 0%{?with_python3}
%files -n python3-wtforms -f wtforms.lang
%doc docs/ LICENSE.txt PKG-INFO
%{python3_sitelib}/*.egg-info/
%{python3_sitelib}/wtforms/
%endif

%changelog
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-6
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

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

* Mon Dec 01 2014 Pierre-Yves Chibon <pingou@pingoured.fr> - 2.0-4
- Move the locale files into /usr/share/locale we will still have the same files
  present in both the py2 and py3 but a) they are completely identical so no
  conflicts from RPM and b) they are now in the proper place, system-wise

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fdoraproject.org> - 2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Sat May 24 2014 Praveen Kumar <kumarpraveen.nitdgp@gmail.com> 2.0-1
- Upgrade to upstream version
- Add python3 support

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

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

* Thu Aug 09 2012 Tim Flink <tflink@fedoraproject.org> - 1.0.2-1
- Upgraded to upstream 1.0.2

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

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

* Thu Jul 21 2011 Praveen Kumar <kumarpraveen.nitdgp@gmail.com> - 0.6.3-1
- Initial RPM release