File python-mwlib.spec of Package python-mwlib
#
# spec file for package python-mwlib
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define mod_name mwlib
Name: python-mwlib
Summary: Mediawiki Parser and Utility Library
Version: 0.15.11
Release: 1
Source0: http://pypi.python.org/packages/source/m/mwlib/%{mod_name}-%{version}.zip
# Removes the following "requires" from setup.py for these reasons:
# roman: part of python-docutils
# timelib: replaced with dateutil
Patch0: mwlib-clean-up-dependencies.patch
# Replaces timelib with dateutil
Patch1: mwlib-replace-timelib-with-dateutil.patch
# Ensure all console scripts are prefixed with 'mw-'
Patch2: mwlib-prefix-console-scripts.patch
License: BSD-2-Clause
Group: Development/Languages/Python
Url: http://pypi.python.org/pypi/python-mwlib
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True);")}
%endif
BuildRequires: python-devel
BuildRequires: gcc-c++ python-imaging python-lxml python-cython re2c
BuildRequires: python-setuptools >= 0.6 unzip
BuildRequires: python-Sphinx
BuildRequires: fdupes
Requires: python-apipkg >= 1.2
Requires: python-pyparsing >= 1.4.11
Requires: python-odfpy >= 0.9
Requires: python-gevent
Requires: python-dateutil
Requires: python-bottle >= 0.10
Requires: python-pypdf >= 1.12
Requires: python-qserve >= 0.2.7
Requires: python-roman
Requires: python-lxml
Requires: python-py >= 1.4
Requires: python-sqlite3dbm
Requires: python-simplejson >= 2.5
Requires: python-greenlet
Requires: python-Pillow
Requires: python-docutils
Requires: python-qserve >= 0.2.7
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
mwlib provides a library for parsing MediaWiki articles and
converting them to different output formats. mwlib is used by
wikipedia's "Print/export" feature in order to generate PDF documents
from wikipedia articles.
%prep
%setup -n %{mod_name}-%{version}
# Clean up dependencies
%patch0 -p0
# Replace timelib with dateutil
%patch1 -p0
# Ensure all console scripts are prefixed with 'mw-'
%patch2 -p0
# fix for rpmlint
sed '/^#!/ c # -\*- mode: wikipedia -\*-' %{mod_name}/snippets.txt > %{mod_name}/snippets1.txt && mv %{mod_name}/snippets1.txt %{mod_name}/snippets.txt
%build
python setup.py build
make html -C docs
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# fix for rpmlint
pushd %{buildroot}%{python_sitearch}/%{mod_name}
list="expr.py nslave.py wiki.py tagext.py templ/magics.py timeline.py treecleanerhelper.py trustedrevs.py \
imgmap.py authors.py expander.py nserve.py strftime.py log.py bookshelf.py odfconf.py writer/formatter.py \
treecleaner.py odfstyles.py writerbase.py mathutils.py caller.py utoken.py metabook.py old_uparser.py \
postman.py snippets.py odfwriter.py writer/miscutils.py serve.py"
for i in $list
do
chmod +x "$i"
done
popd
rm docs/_build/html/.buildinfo
%fdupes -s %{buildroot}%{python_sitearch}
%fdupes -s docs/_build/html
%files
%defattr(-,root,root)
%doc changelog.rst README.rst docs/_build/html
%{_bindir}/*
%{python_sitearch}/%{mod_name}*
%changelog