python-rdflib/python-rdflib.spec

135 lines
4.9 KiB
RPMSpec

#
# spec file for package python-rdflib
#
# 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/
#
Name: python-rdflib
Version: 4.0.1
Release: 0
Summary: A Python library for working with RDF
License: BSD-3-Clause
Group: Development/Libraries/Python
Url: http://rdflib.net/
Source: http://pypi.python.org/packages/source/r/rdflib/rdflib-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: fdupes
BuildRequires: python-SPARQLWrapper
BuildRequires: python-Sphinx
BuildRequires: python-devel
BuildRequires: python-flake8
BuildRequires: python-html5lib
BuildRequires: python-isodate
BuildRequires: python-nose
BuildRequires: python-pyparsing
BuildRequires: python-setuptools
BuildRequires: python-xml
Requires: python-SPARQLWrapper
Requires: python-flake8
Requires: python-html5lib
Requires: python-isodate
Requires: python-pyparsing
Requires: python-xml
Requires(post): update-alternatives
Requires(postun): update-alternatives
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch: noarch
%endif
%description
RDFLib is a Python library for working with RDF, a simple yet powerful
language for representing information. The library contains an RDF/XML
parser/serializer that conforms to the RDF/XML Syntax Specification (Revised).
The library also contains both in-memory and persistent Graph backends.
%prep
%setup -q -n rdflib-%{version}
# Drop py2.7 bytecode files, we have to rebuild these:
find . -type f -name "*.pyc" -print -delete
%build
python setup.py build
cd docs
make html
# Remove hidden file
rm -r _build/html/.buildinfo
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# for update-alternatives
mv %{buildroot}%{_bindir}/csv2rdf %{buildroot}%{_bindir}/csv2rdf-%{py_ver}
mv %{buildroot}%{_bindir}/rdf2dot %{buildroot}%{_bindir}/rdf2dot-%{py_ver}
mv %{buildroot}%{_bindir}/rdfgraphisomorpishm %{buildroot}%{_bindir}/rdfgraphisomorpishm-%{py_ver}
mv %{buildroot}%{_bindir}/rdfpipe %{buildroot}%{_bindir}/rdfpipe-%{py_ver}
mv %{buildroot}%{_bindir}/rdfs2dot %{buildroot}%{_bindir}/rdfs2dot-%{py_ver}
ln -s %{_bindir}/csv2rdf-%{py_ver} %{buildroot}%{_bindir}/csv2rdf
ln -s %{_bindir}/rdf2dot-%{py_ver} %{buildroot}%{_bindir}/rdf2dot
ln -s %{_bindir}/rdfgraphisomorpishm-%{py_ver} %{buildroot}%{_bindir}/rdfgraphisomorpishm
ln -s %{_bindir}/rdfpipe-%{py_ver} %{buildroot}%{_bindir}/rdfpipe
ln -s %{_bindir}/rdfs2dot-%{py_ver} %{buildroot}%{_bindir}/rdfs2dot
# fix end-of-line encoding
sed -i 's/\r$//' docs/_build/html/_static/jquery.js
%fdupes -s docs/_build/html
%pre
# Since /usr/bin/* became ghosted to be used with update-alternatives, we have to get rid
# of the old binary resulting from the non-update-alternativies-ified package:
[[ ! -L %{_bindir}/csv2rdf ]] && rm -f %{_bindir}/csv2rdf
[[ ! -L %{_bindir}/rdf2dot ]] && rm -f %{_bindir}/rdf2dot
[[ ! -L %{_bindir}/rdfgraphisomorpishm ]] && rm -f %{_bindir}/rdfgraphisomorpishm
[[ ! -L %{_bindir}/rdfpipe ]] && rm -f %{_bindir}/rdfpipe
[[ ! -L %{_bindir}/rdfs2dot ]] && rm -f %{_bindir}/rdfs2dot
exit 0
%post
update-alternatives \
--install %{_bindir}/rdfpipe rdfpipe %{_bindir}/rdfpipe-%{py_ver} 30 \
--slave %{_bindir}/csv2rdf csv2rdf %{_bindir}/csv2rdf%{py_ver} \
--slave %{_bindir}/rdf2dot rdf2dot %{_bindir}/rdf2dot%{py_ver} \
--slave %{_bindir}/rdfgraphisomorpishm rdfgraphisomorpishm %{_bindir}/rdfgraphisomorpishm%{py_ver} \
--slave %{_bindir}/rdfs2dot rdfs2dot %{_bindir}/rdfs2dot%{py_ver}
%preun
if [ $1 -eq 0 ] ; then
update-alternatives --remove rdfpipe %{_bindir}/rdfpipe-%{py_ver}
fi
# Not working
# %check
# python setup.py test
%files
%defattr(-,root,root)
%doc CHANGELOG.md LICENSE CONTRIBUTORS README.md docs/_build/html
%{_bindir}/csv2rdf-%{py_ver}
%{_bindir}/rdf2dot-%{py_ver}
%{_bindir}/rdfgraphisomorpishm-%{py_ver}
%{_bindir}/rdfpipe-%{py_ver}
%{_bindir}/rdfs2dot-%{py_ver}
%ghost %{_bindir}/csv2rdf
%ghost %{_bindir}/rdf2dot
%ghost %{_bindir}/rdfgraphisomorpishm
%ghost %{_bindir}/rdfpipe
%ghost %{_bindir}/rdfs2dot
%{python_sitelib}/rdflib/
%{python_sitelib}/rdflib-%{version}-py*.egg-info
%changelog