Blob Blame Raw
%global modname zope.schema

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

Summary: Zope 3 schemas
Name: python-zope-schema
Version: 4.3.2
Release: 1%{?dist}
Source0: http://pypi.python.org/packages/source/z/%{modname}/%{modname}-%{version}.zip
License: ZPLv2.1
Group: Development/Libraries
BuildArch: noarch
URL: http://pypi.python.org/pypi/zope.schema

BuildRequires: python-sphinx

BuildRequires: python2-devel
BuildRequires: python-setuptools
# For tests
BuildRequires: python-zope-testing
BuildRequires: python-zope-interface
BuildRequires: python-zope-event

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

Requires: python-zope-interface
Requires: python-zope-event

%description
This package is a zope.interface extension for defining data schemas.

%if 0%{?with_python3}
%package -n python3-zope-schema
Summary:        Zope 3 schemas
Group:          Development/Libraries

Requires: python3-zope-interface
Requires: python3-zope-event

%description -n python3-zope-schema
This package is a zope.interface extension for defining data schemas.
%endif

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

rm -rf %{modname}.egg-info

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


%build
%{__python} setup.py build

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

# build Sphinx documents
COPYRIGHT=`grep Author: PKG-INFO |sed -e 's/Author: //'`
cat >src/zope/schema/conf.py <<END
templates_path = ['_templates']
source_suffix = '.txt'
master_doc = 'index'
project = '%{modname}'
copyright = '$COPYRIGHT'
version = '%{version}'
release = '%{version}'
pygments_style = 'sphinx'
html_static_path = ['_static']
extensions = []
END

sphinx-build -b html src/zope/schema/ html

rm -fr html/{.buildinfo,.doctrees}

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

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

%files
%defattr(-,root,root,-)
%doc LICENSE.txt CHANGES.rst COPYRIGHT.txt README.rst
%doc html/
%{python_sitelib}/zope/schema/
%exclude %{python_sitelib}/zope/schema/tests/
%exclude %{python_sitelib}/zope/schema/*.txt
%{python_sitelib}/%{modname}-*.egg-info
%{python_sitelib}/%{modname}-*-nspkg.pth

%if 0%{?with_python3}
%files -n python3-zope-schema
%doc LICENSE.txt CHANGES.rst COPYRIGHT.txt README.rst
%doc html/
%{python3_sitelib}/zope/schema/
%exclude %{python3_sitelib}/zope/schema/tests/
%exclude %{python3_sitelib}/zope/schema/*.txt
%{python3_sitelib}/%{modname}-*.egg-info
%{python3_sitelib}/%{modname}-*-nspkg.pth
%endif


%changelog
* Mon Feb 25 2013 Ralph Bean <rbean@redhat.com> - 4.3.2-1
- Latest upstream.
- README and CHANGES renamed from .txt to .rst.

* Wed Feb 13 2013 Ralph Bean <rbean@redhat.com> - 4.2.2-1
- Latest upstream.
- Added Python3 subpackage.
- Removed dos2unix references.  No longer needed.

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

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

* Mon Sep 26 2011 Robin Lee <cheeselee@fedoraproject.org> - 3.8.1-1
- Update to 3.8.1 (#741003)
- Fix ends of lines

* Thu Mar 31 2011 Robin Lee <cheeselee@fedoraproject.org> - 3.8.0-1
- Update to 3.8.0 (#689215)

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.7.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Mon Jan  3 2011 Robin Lee <cheeselee@fedoraproject.org> - 3.7.1-1
- Update to 3.7.1
- Build Sphinx documents

* Thu Sep 16 2010 Robin Lee <robinlee.sysu@gmail.com> - 3.7.0-1
- Update to 3.7.0
- Move the documents to proper place
- Exclude the tests

* Sat Sep 11 2010 Robin Lee <robinlee.sysu@gmail.com> - 3.6.4-2
- Spec cleaned up
- Requires: python-zope-filesystem and python-setuptools removed
- Add %%check section and run tests
- BR: python-zope-testing and runtime requirements added
- Don't move the text files

* Wed Jun 16 2010 Robin Lee <robinlee.sysu@gmail.com> - 3.6.4-1
- Initial packaging