Blob Blame History Raw
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}

# The upstream test suite does not pass on recent versions of Fedora
# See package review (bug 378841)
# For now, we disable running the test suite:
%define run_tests 0

Name:           python-rdflib
Version:        2.4.0
Release:        7%{?dist}
Summary:        Python library for working with RDF

Group:          Development/Languages
License:        BSD
URL:            http://rdflib.net
Source0:        http://rdflib.net/rdflib-2.4.0.tar.gz

# Filter out unwanted autogenerated Provides: SPARQLParserc.so
# See http://fedoraproject.org/wiki/PackagingDrafts/FilteringAutomaticDependencies
Source1:        filter-provides.sh
%define _use_internal_dependency_generator 0
%define __find_provides %{SOURCE1}

BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

BuildRequires:  python-devel
%if 0%{?fedora} >= 8
BuildRequires: python-setuptools-devel
%else
BuildRequires: python-setuptools
%endif

%if %{run_tests}
BuildRequires:  python-nose >= 0.9.2
%endif

%description
RDFLib is a Python library for working with RDF, a simple yet powerful
language for representing information.

The library contains parsers and serializers for RDF/XML, N3, NTriples,
Turtle, TriX and RDFa. The library presents a Graph interface which can
be backed by any one of a number of store implementations, including
memory, MySQL, Redland, SQLite, Sleepycat, ZODB and SQLObject.

%prep
%setup -q -n rdflib-%{version}
chmod +x %{SOURCE1}

%build
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build

%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
cp LICENSE $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/LICENSE
rm -rf $RPM_BUILD_ROOT/%{python_sitearch}/test

# Various .py files within site-packages have a shebang line but aren't
# flagged as executable.
# I've gone through them and either removed the shebang or made them
# executable as appropriate:
#   rdflib_tools/RDFPipe.py: __main__ parses RDF from stdin
chmod +x $RPM_BUILD_ROOT/%{python_sitearch}/rdflib_tools/RDFPipe.py

#   sparql/parser.py: __main__ runs self-tests:
chmod +x $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/sparql/parser.py

#   syntax/parsers/n3meta.py doesn't have a meaningful __main__; drop
#   the shebang:
%{__sed} -i "s|#!/usr/bin/env python||" $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/syntax/parsers/n3p/n3meta.py

#   syntax/parsers/ntriples.py: __main__ parses NTriples from a URI:
chmod +x $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/syntax/parsers/ntriples.py

#   syntax/parsers/n3p/n3p.py:  __main__ parses N3 from a file
chmod +x $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/syntax/parsers/n3p/n3p.py

#   syntax/parsers/n3p/uripath.py: __main__ runs unit tests:
chmod +x $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/syntax/parsers/n3p/uripath.py

#   syntax/parsers/n3p/n3proc.py: __main__ parses from a URI:
chmod +x $RPM_BUILD_ROOT/%{python_sitearch}/rdflib/syntax/parsers/n3p/n3proc.py

%check
%if %{run_tests}
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py test
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc LICENSE
%{python_sitearch}/*
%{_bindir}/rdfpipe

%changelog
* Wed Oct  1 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-7
- fix tab/space issue in specfile

* Tue Sep 30 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-6
- override autogeneration of provides info to eliminate unwanted provision
of SPARQLParserc.so

* Mon Sep 29 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-5
- make various scripts executable, or remove shebang, as appropriate

* Tue Feb 19 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-4
- delete test subdir

* Thu Jan 24 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-3
- introduce macro to disable running the test suite, in the hope of eventually
patching it so it passes

* Mon Nov 19 2007 David Malcolm <dmalcolm@redhat.com> - 2.4.0-2
- add python-setuptools(-devel) build requirement; move testing to correct stanza

* Wed Aug  1 2007 David Malcolm <dmalcolm@redhat.com> - 2.4.0-1
- initial version