159fe48
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
159fe48
159fe48
# The upstream test suite does not pass on recent versions of Fedora
159fe48
# See package review (bug 378841)
159fe48
# For now, we disable running the test suite:
159fe48
%define run_tests 0
159fe48
159fe48
Name:           python-rdflib
159fe48
Version:        2.4.0
159fe48
Release:        7%{?dist}
159fe48
Summary:        Python library for working with RDF
159fe48
159fe48
Group:          Development/Languages
159fe48
License:        BSD
159fe48
URL:            http://rdflib.net
159fe48
Source0:        http://rdflib.net/rdflib-2.4.0.tar.gz
159fe48
159fe48
# Filter out unwanted autogenerated Provides: SPARQLParserc.so
159fe48
# See http://fedoraproject.org/wiki/PackagingDrafts/FilteringAutomaticDependencies
159fe48
Source1:        filter-provides.sh
159fe48
%define _use_internal_dependency_generator 0
159fe48
%define __find_provides %{SOURCE1}
159fe48
159fe48
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
159fe48
159fe48
BuildRequires:  python-devel
159fe48
%if 0%{?fedora} >= 8
159fe48
BuildRequires: python-setuptools-devel
159fe48
%else
159fe48
BuildRequires: python-setuptools
159fe48
%endif
159fe48
159fe48
%if %{run_tests}
159fe48
BuildRequires:  python-nose >= 0.9.2
159fe48
%endif
159fe48
159fe48
%description
159fe48
RDFLib is a Python library for working with RDF, a simple yet powerful
159fe48
language for representing information.
159fe48
159fe48
The library contains parsers and serializers for RDF/XML, N3, NTriples,
159fe48
Turtle, TriX and RDFa. The library presents a Graph interface which can
159fe48
be backed by any one of a number of store implementations, including
159fe48
memory, MySQL, Redland, SQLite, Sleepycat, ZODB and SQLObject.
159fe48
159fe48
%prep
159fe48
%setup -q -n rdflib-%{version}
159fe48
chmod +x %{SOURCE1}
159fe48
159fe48
%build
159fe48
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
159fe48
159fe48
%install
159fe48
rm -rf $RPM_BUILD_ROOT
159fe48
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
159fe48
cp LICENSE $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/LICENSE
159fe48
rm -rf $RPM_BUILD_ROOT/%{python_sitearch}/test
159fe48
159fe48
# Various .py files within site-packages have a shebang line but aren't
159fe48
# flagged as executable.
159fe48
# I've gone through them and either removed the shebang or made them
159fe48
# executable as appropriate:
159fe48
#   rdflib_tools/RDFPipe.py: __main__ parses RDF from stdin
159fe48
chmod +x $RPM_BUILD_ROOT/%{python_sitearch}/rdflib_tools/RDFPipe.py
159fe48
159fe48
#   sparql/parser.py: __main__ runs self-tests:
159fe48
chmod +x $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/sparql/parser.py
159fe48
159fe48
#   syntax/parsers/n3meta.py doesn't have a meaningful __main__; drop
159fe48
#   the shebang:
159fe48
%{__sed} -i "s|#!/usr/bin/env python||" $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/syntax/parsers/n3p/n3meta.py
159fe48
159fe48
#   syntax/parsers/ntriples.py: __main__ parses NTriples from a URI:
159fe48
chmod +x $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/syntax/parsers/ntriples.py
159fe48
159fe48
#   syntax/parsers/n3p/n3p.py:  __main__ parses N3 from a file
159fe48
chmod +x $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/syntax/parsers/n3p/n3p.py
159fe48
159fe48
#   syntax/parsers/n3p/uripath.py: __main__ runs unit tests:
159fe48
chmod +x $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/syntax/parsers/n3p/uripath.py
159fe48
159fe48
#   syntax/parsers/n3p/n3proc.py: __main__ parses from a URI:
159fe48
chmod +x $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/syntax/parsers/n3p/n3proc.py
159fe48
159fe48
%check
159fe48
%if %{run_tests}
159fe48
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py test
159fe48
%endif
159fe48
159fe48
%clean
159fe48
rm -rf $RPM_BUILD_ROOT
159fe48
159fe48
%files
159fe48
%defattr(-,root,root,-)
159fe48
%doc LICENSE
159fe48
%{python_sitearch}/*
159fe48
%{_bindir}/rdfpipe
159fe48
159fe48
%changelog
159fe48
* Wed Oct  1 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-7
159fe48
- fix tab/space issue in specfile
159fe48
159fe48
* Tue Sep 30 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-6
159fe48
- override autogeneration of provides info to eliminate unwanted provision
159fe48
of SPARQLParserc.so
159fe48
159fe48
* Mon Sep 29 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-5
159fe48
- make various scripts executable, or remove shebang, as appropriate
159fe48
159fe48
* Tue Feb 19 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-4
159fe48
- delete test subdir
159fe48
159fe48
* Thu Jan 24 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-3
159fe48
- introduce macro to disable running the test suite, in the hope of eventually
159fe48
patching it so it passes
159fe48
159fe48
* Mon Nov 19 2007 David Malcolm <dmalcolm@redhat.com> - 2.4.0-2
159fe48
- add python-setuptools(-devel) build requirement; move testing to correct stanza
159fe48
159fe48
* Wed Aug  1 2007 David Malcolm <dmalcolm@redhat.com> - 2.4.0-1
159fe48
- initial version
159fe48