25a74e4
%if 0%{?fedora} > 12
25a74e4
%global with_python3 1
25a74e4
%endif
25a74e4
25a74e4
%{!?__python2:%global __python2 %{__python}}
25a74e4
%{!?python2_sitelib:   %global python2_sitelib         %{python_sitelib}}
25a74e4
%{!?python2_sitearch:  %global python2_sitearch        %{python_sitearch}}
25a74e4
%{!?python2_version:   %global python2_version         %{python_version}}
25a74e4
25a74e4
%global pypi_name rdflib
25a74e4
25a74e4
%global run_tests 1
178ba02
178ba02
Name:           python-rdflib
3b6d3ea
Version:        4.1.2
25a74e4
Release:        3%{?dist}
178ba02
Summary:        Python library for working with RDF
178ba02
178ba02
Group:          Development/Languages
178ba02
License:        BSD
499cd94
URL:            https://github.com/RDFLib/rdflib
de6c6d1
Source0:        http://pypi.python.org/packages/source/r/rdflib/rdflib-%{version}.tar.gz
499cd94
Patch1:         python-rdflib-SPARQLWrapper-optional.patch
bb63a7d
BuildArch:      noarch
178ba02
e0de872
Requires:       python-html5lib >= 1:
7584bd6
Requires:       python-isodate
499cd94
Requires:       pyparsing
178ba02
e0de872
BuildRequires:  python-html5lib >= 1:
2f832ef
BuildRequires:  python-isodate
499cd94
BuildRequires:  pyparsing
25a74e4
BuildRequires:  python2-devel
25a74e4
BuildRequires:  python-setuptools
178ba02
178ba02
%if %{run_tests}
178ba02
BuildRequires:  python-nose >= 0.9.2
178ba02
%endif
178ba02
499cd94
Obsoletes:      python-rdfextras <= 0.1-7
499cd94
25a74e4
178ba02
%description
178ba02
RDFLib is a Python library for working with RDF, a simple yet powerful
178ba02
language for representing information.
178ba02
499cd94
The library contains parsers and serializers for RDF/XML, N3,
499cd94
NTriples, Turtle, TriX, RDFa and Microdata. The library presents
499cd94
a Graph interface which can be backed by any one of a number of
499cd94
Store implementations. The core rdflib includes store
499cd94
implementations for in memory storage, persistent storage on top
499cd94
of the Berkeley DB, and a wrapper for remote SPARQL endpoints.
499cd94
499cd94
A SPARQL 1.1 engine is also included.
178ba02
25a74e4
25a74e4
%if %{with_python3}
25a74e4
%package -n python3-%{pypi_name}
25a74e4
Summary:        Python library for working with RDF
25a74e4
25a74e4
BuildRequires:  python3-html5lib >= 1:
25a74e4
BuildRequires:  python3-isodate
25a74e4
BuildRequires:  python3-pyparsing
25a74e4
BuildRequires:  python3-devel
25a74e4
BuildRequires:  python3-setuptools
25a74e4
25a74e4
%if %{run_tests}
25a74e4
BuildRequires:  python3-nose >= 0.9.2
25a74e4
%endif
25a74e4
25a74e4
25a74e4
%description -n python3-%{pypi_name}
25a74e4
RDFLib is a Python library for working with RDF, a simple yet powerful
25a74e4
language for representing information.
25a74e4
25a74e4
The library contains parsers and serializers for RDF/XML, N3,
25a74e4
NTriples, Turtle, TriX, RDFa and Microdata. The library presents
25a74e4
a Graph interface which can be backed by any one of a number of
25a74e4
Store implementations. The core rdflib includes store
25a74e4
implementations for in memory storage, persistent storage on top
25a74e4
of the Berkeley DB, and a wrapper for remote SPARQL endpoints.
25a74e4
25a74e4
A SPARQL 1.1 engine is also included.
25a74e4
%endif
25a74e4
178ba02
%prep
48dfb5c
%setup -q -n rdflib-%{version}
499cd94
%patch1 -p1
25a74e4
25a74e4
# remove bundled egg-info
25a74e4
rm -rf %{pypi_name}.egg-info
25a74e4
c9394c6
find -name "*.pyc" -delete
c9394c6
c9394c6
sed -i -e 's|_sn_gen=bnode_uuid()|_sn_gen=bnode_uuid|' test/test_bnode_ncname.py
c9394c6
25a74e4
%if 0%{?with_python3}
25a74e4
rm -rf %{py3dir}
25a74e4
cp -a . %{py3dir}
25a74e4
%endif
178ba02
178ba02
%build
25a74e4
%if 0%{?with_python3}
25a74e4
pushd %{py3dir}
25a74e4
%{__python3} setup.py build
25a74e4
popd
25a74e4
%endif # with_python3
25a74e4
25a74e4
%{__python2} setup.py build
178ba02
178ba02
%install
25a74e4
%if 0%{?with_python3}
25a74e4
pushd %{py3dir}
25a74e4
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
25a74e4
popd
25a74e4
25a74e4
# rename binaries
25a74e4
for i in csv2rdf rdf2dot rdfgraphisomorphism rdfpipe rdfs2dot; do
25a74e4
    mv %{buildroot}%{_bindir}/$i %{buildroot}%{_bindir}/python3-$i
25a74e4
done
25a74e4
25a74e4
%endif
25a74e4
25a74e4
%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
bb63a7d
cp LICENSE $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/LICENSE
178ba02
178ba02
# Various .py files within site-packages have a shebang line but aren't
178ba02
# flagged as executable.
178ba02
# I've gone through them and either removed the shebang or made them
178ba02
# executable as appropriate:
178ba02
bb63a7d
# __main__ parses URI as N-Triples:
c9394c6
chmod +x $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/plugins/parsers/ntriples.py
178ba02
bb63a7d
# __main__ parses the file given on the command line:
c9394c6
chmod +x $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/plugins/parsers/notation3.py
178ba02
499cd94
# __main__ parses the file or URI given on the command line:
499cd94
chmod +x $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/tools/rdfpipe.py
499cd94
499cd94
# __main__ runs a test (well, it's something)
499cd94
chmod +x $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/extras/infixowl.py
499cd94
499cd94
# sed these headers out as they include no __main__
499cd94
for lib in $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/extras/describer.py \
499cd94
    $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/plugins/parsers/pyRdfa/extras/httpheader.py \
499cd94
    $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/plugins/parsers/structureddata.py; do
499cd94
 sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
499cd94
 touch -r $lib $lib.new &&
499cd94
 mv $lib.new $lib
499cd94
done
178ba02
178ba02
%check
178ba02
%if %{run_tests}
2f832ef
sed -i -e "s|'--with-doctest'|#'--with-doctest'|" run_tests.py
ed56506
sed -i -e "s|'--doctest-tests'|#'--doctest-tests'|" run_tests.py
70134fd
sed -i -e "s|with-doctest = 1|#with-doctest = 1|" setup.cfg
3b6d3ea
PYTHONPATH=./build/lib %{__python} run_tests.py --verbose
178ba02
%endif
178ba02
178ba02
%files
178ba02
%doc LICENSE
25a74e4
%{python_sitelib}/%{pypi_name}
25a74e4
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info
25a74e4
%{_bindir}/csv2rdf
25a74e4
%{_bindir}/rdf2dot
25a74e4
%{_bindir}/rdfgraphisomorphism
25a74e4
%{_bindir}/rdfpipe
25a74e4
%{_bindir}/rdfs2dot
25a74e4
25a74e4
%if 0%{?with_python3}
25a74e4
%files -n python3-%{pypi_name}
25a74e4
%doc LICENSE
25a74e4
%{python3_sitelib}/%{pypi_name}
25a74e4
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
25a74e4
%{_bindir}/python3-csv2rdf
25a74e4
%{_bindir}/python3-rdf2dot
25a74e4
%{_bindir}/python3-rdfgraphisomorphism
25a74e4
%{_bindir}/python3-rdfpipe
25a74e4
%{_bindir}/python3-rdfs2dot
25a74e4
%endif
178ba02
178ba02
%changelog
25a74e4
* Mon Jan 05 2015 Matthias Runge <mrunge@redhat.com> - 4.1.2-3
25a74e4
- add python3 subpackage (rhbz#1086844)
25a74e4
b5f6110
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.1.2-2
b5f6110
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
b5f6110
3b6d3ea
* Fri Apr 18 2014 Dan Scott <dan@coffeecode.net> - 4.1.2-1
3b6d3ea
- Update for 4.1.2 release
3b6d3ea
- Add PYTHONPATH awareness for running tests
3b6d3ea
499cd94
* Tue Mar 04 2014 Dan Scott <dan@coffeecode.net> - 4.1.1-1
499cd94
- Update for 4.1.1 release
499cd94
- Support for RDF 1.1 and HTML5
499cd94
- Support for RDFa, TRiG, microdata parsers, and HTML structured data
499cd94
- Patch to make SPARQLWrapper an extras_require until it is packaged
499cd94
d0db4c0
* Thu Dec 12 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 3.2.3-6
d0db4c0
- Remove BR of python-setuptools-devel
d0db4c0
d2a23e4
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.3-5
d2a23e4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
d2a23e4
70134fd
* Wed Mar 27 2013 David Malcolm <dmalcolm@redhat.com> - 3.2.3-4
70134fd
- disable doctests (rhbz#914414)
70134fd
2d39b5c
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.3-3
2d39b5c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
2d39b5c
c9394c6
* Wed Oct 10 2012  Pierre-Yves Chibon <pingou@pingoured.fr> - 3.2.3-2
c9394c6
- Re-enable tests
c9394c6
- Backport using sed unit-tests fix from upstream
c9394c6
   (commit 26d25faa90483ed1ba7675d159d10e955dbaf442)
c9394c6
de6c6d1
* Wed Oct 10 2012  Pierre-Yves Chibon <pingou@pingoured.fr> - 3.2.3-1
de6c6d1
- Update to 3.2.3
de6c6d1
- One test is failing, so disabling them for now
de6c6d1
017ee56
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.0-5
017ee56
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
017ee56
2f832ef
* Tue Jan 24 2012 Pierre-Yves Chibon <pingou@pingoured.fr> - 3.2.0-4
2f832ef
- Re-add the unittests, for that, patch one and disable the run of
2f832ef
the tests in the documentation of the code.
2f832ef
7584bd6
* Mon Jan 23 2012 Pierre-Yves Chibon <pingou@pingoured.fr> - 3.2.0-3
7584bd6
- Add python-isodate as R (RHBZ#784027)
7584bd6
bc737c7
* Fri Jan 20 2012 Pierre-Yves Chibon <pingou@pingoured.fr> - 3.2.0-2
bc737c7
- Found the official sources of the 3.2.0 release
bc737c7
6015524
* Fri Jan 20 2012 Pierre-Yves Chibon <pingou@pingoured.fr> - 3.2.0-1
6015524
- Update to 3.2.0-RC which seem to be same as 3.2.0
6015524
ecca0c2
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-2
ecca0c2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
ecca0c2
bb63a7d
* Wed Sep 28 2011 David Malcolm <dmalcolm@redhat.com> - 3.1.0-1
bb63a7d
- 3.1.0; converting from arch-specific to noarch (sitearch -> sitelib);
bb63a7d
removing rdfpipe and various other extensions
bb63a7d
32e8519
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.2-3
32e8519
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
32e8519
a099d76
* Thu Jul 22 2010 Thomas Spura <tomspur@fedoraproject.org> - 2.4.2-2
a099d76
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
a099d76
74c3f53
* Wed Jan  6 2010 David Malcolm <dmalcolm@redhat.com> - 2.4.2-1
74c3f53
- bump to 2.4.2 (#552909)
74c3f53
- fix source URL to use version macro
74c3f53
bbb5a59
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.0-10
bbb5a59
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
bbb5a59
2e1cd47
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.0-9
2e1cd47
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
2e1cd47
3fff280
* Wed Dec 10 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.4.0-8
3fff280
- Rebuild for Python 2.6
3fff280
178ba02
* Wed Oct  1 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-7
178ba02
- fix tab/space issue in specfile
178ba02
178ba02
* Tue Sep 30 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-6
178ba02
- override autogeneration of provides info to eliminate unwanted provision
178ba02
of SPARQLParserc.so
178ba02
178ba02
* Mon Sep 29 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-5
178ba02
- make various scripts executable, or remove shebang, as appropriate
178ba02
178ba02
* Tue Feb 19 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-4
178ba02
- delete test subdir
178ba02
178ba02
* Thu Jan 24 2008 David Malcolm <dmalcolm@redhat.com> - 2.4.0-3
178ba02
- introduce macro to disable running the test suite, in the hope of eventually
178ba02
patching it so it passes
178ba02
178ba02
* Mon Nov 19 2007 David Malcolm <dmalcolm@redhat.com> - 2.4.0-2
178ba02
- add python-setuptools(-devel) build requirement; move testing to correct stanza
178ba02
178ba02
* Wed Aug  1 2007 David Malcolm <dmalcolm@redhat.com> - 2.4.0-1
178ba02
- initial version
178ba02