Update to 4.2.1, rewrite spec

epel9
Miro Hrončok 8 years ago
parent a7265992b4
commit cd0dee68da

1
.gitignore vendored

@ -5,3 +5,4 @@ rdflib-2.4.2.tar.gz
/rdflib-3.2.3.tar.gz
/rdflib-4.1.1.tar.gz
/rdflib-4.1.2.tar.gz
/rdflib-4.2.1.tar.gz

@ -7,16 +7,13 @@ Per discussion in https://github.com/RDFLib/rdflib/pull/359
Signed-off-by: Dan Scott <dan@coffeecode.net>
---
setup.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/setup.py b/setup.py
index c00a978..380d449 100644
index c21cc27..d7a8347 100644
--- a/setup.py
+++ b/setup.py
@@ -41,8 +41,8 @@ if sys.version_info[0] >= 3:
kwargs['install_requires'] = ['isodate', 'pyparsing']
kwargs['tests_require'] = ['html5lib']
kwargs['tests_require'] = ['html5lib', 'networkx']
kwargs['requires'] = [
- 'isodate', 'pyparsing',
- 'SPARQLWrapper']
@ -32,9 +29,37 @@ index c00a978..380d449 100644
- 'pyparsing', 'SPARQLWrapper']
+ 'pyparsing']
+ kwargs['extras_require'] = {'SPARQLStore': 'SPARQLWrapper'}
kwargs['tests_require'] = ['networkx']
if sys.version_info[1]<7: # Python 2.6
kwargs['install_requires'].append('ordereddict')
--
1.8.5.3
diff --git a/test/test_dataset.py b/test/test_dataset.py
index 4d39c3d..d12d054 100644
--- a/test/test_dataset.py
+++ b/test/test_dataset.py
@@ -2,6 +2,12 @@ import sys
import os
import unittest
+try:
+ import SPARQLWrapper
+except ImportError:
+ from nose.exc import SkipTest
+ raise SkipTest("SPARQLWrapper not installed")
+
from tempfile import mkdtemp, mkstemp
import shutil
from rdflib import Graph, Dataset, URIRef, BNode, plugin
diff --git a/test/test_issue457.py b/test/test_issue457.py
index f9957db..8c6f491 100644
--- a/test/test_issue457.py
+++ b/test/test_issue457.py
@@ -1,4 +1,9 @@
# test for https://github.com/RDFLib/rdflib/issues/457
+try:
+ import SPARQLWrapper
+except ImportError:
+ from nose.exc import SkipTest
+ raise SkipTest("SPARQLWrapper not installed")
import io
from xml.etree import ElementTree

@ -1,45 +1,36 @@
%if 0%{?fedora} > 12
%global with_python3 1
%endif
%{!?__python2:%global __python2 %{__python}}
%{!?python2_sitelib: %global python2_sitelib %{python_sitelib}}
%{!?python2_sitearch: %global python2_sitearch %{python_sitearch}}
%{!?python2_version: %global python2_version %{python_version}}
%global pypi_name rdflib
%global run_tests 1
Name: python-rdflib
Version: 4.1.2
Release: 8%{?dist}
Name: python-%{pypi_name}
Version: 4.2.1
Release: 1%{?dist}
Summary: Python library for working with RDF
Group: Development/Languages
License: BSD
URL: https://github.com/RDFLib/rdflib
Source0: http://pypi.python.org/packages/source/r/rdflib/rdflib-%{version}.tar.gz
Patch1: python-rdflib-SPARQLWrapper-optional.patch
Patch1: %{name}-SPARQLWrapper-optional.patch
BuildArch: noarch
Requires: python-html5lib >= 1:
Requires: python-isodate
Requires: pyparsing
BuildRequires: python-html5lib >= 1:
BuildRequires: python-isodate
BuildRequires: pyparsing
BuildRequires: python2-pyparsing
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python2-setuptools
BuildRequires: python3-html5lib >= 1:
BuildRequires: python3-isodate
BuildRequires: python3-pyparsing
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%if %{run_tests}
BuildRequires: python-nose >= 0.9.2
BuildRequires: python3-nose >= 0.9.2
%endif
Obsoletes: python-rdfextras <= 0.1-7
%description
RDFLib is a Python library for working with RDF, a simple yet powerful
language for representing information.
@ -51,24 +42,37 @@ Store implementations. The core rdflib includes store
implementations for in memory storage, persistent storage on top
of the Berkeley DB, and a wrapper for remote SPARQL endpoints.
A SPARQL 1.1 engine is also included.
%package -n python2-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{pypi_name}}
Requires: python-html5lib >= 1:
Requires: python-isodate
Requires: python2-pyparsing
Obsoletes: python-rdfextras <= 0.1-7
Provides: python-rdfextras = %{version}-%{release}
%if %{with_python3}
%package -n python3-%{pypi_name}
Summary: Python library for working with RDF
%description -n python2-%{pypi_name}
RDFLib is a Python library for working with RDF, a simple yet powerful
language for representing information.
BuildRequires: python3-html5lib >= 1:
BuildRequires: python3-isodate
BuildRequires: python3-pyparsing
BuildRequires: python3-devel
BuildRequires: python3-setuptools
The library contains parsers and serializers for RDF/XML, N3,
NTriples, Turtle, TriX, RDFa and Microdata. The library presents
a Graph interface which can be backed by any one of a number of
Store implementations. The core rdflib includes store
implementations for in memory storage, persistent storage on top
of the Berkeley DB, and a wrapper for remote SPARQL endpoints.
%if %{run_tests}
BuildRequires: python3-nose >= 0.9.2
%endif
This is for Python 2.
%package -n python3-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}
Requires: python3-html5lib >= 1:
Requires: python3-isodate
Requires: python3-pyparsing
%description -n python3-%{pypi_name}
RDFLib is a Python library for working with RDF, a simple yet powerful
language for representing information.
@ -80,8 +84,7 @@ Store implementations. The core rdflib includes store
implementations for in memory storage, persistent storage on top
of the Berkeley DB, and a wrapper for remote SPARQL endpoints.
A SPARQL 1.1 engine is also included.
%endif
This is for Python 3.
%prep
%setup -q -n rdflib-%{version}
@ -94,35 +97,41 @@ find -name "*.pyc" -delete
sed -i -e 's|_sn_gen=bnode_uuid()|_sn_gen=bnode_uuid|' test/test_bnode_ncname.py
%if 0%{?with_python3}
# Separate dirs needed
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
%py3_build
popd
%endif # with_python3
%{__python2} setup.py build
%py2_build
%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
%py3_install
popd
# rename binaries
for i in csv2rdf rdf2dot rdfgraphisomorphism rdfpipe rdfs2dot; do
mv %{buildroot}%{_bindir}/$i %{buildroot}%{_bindir}/python3-$i
mv %{buildroot}%{_bindir}/$i %{buildroot}%{_bindir}/$i-%{python3_version}
ln -s $i-%{python3_version} %{buildroot}%{_bindir}/$i-3
done
%endif
%py2_install
# rename binaries
for i in csv2rdf rdf2dot rdfgraphisomorphism rdfpipe rdfs2dot; do
mv %{buildroot}%{_bindir}/$i %{buildroot}%{_bindir}/$i-%{python2_version}
ln -s $i-%{python2_version} %{buildroot}%{_bindir}/$i-2
ln -s $i-2 %{buildroot}%{_bindir}/$i
done
%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
cp LICENSE $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/LICENSE
cp LICENSE %{buildroot}%{python2_sitelib}/rdflib/LICENSE
cp LICENSE %{buildroot}%{python3_sitelib}/rdflib/LICENSE
# Various .py files within site-packages have a shebang line but aren't
# flagged as executable.
@ -130,57 +139,91 @@ cp LICENSE $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/LICENSE
# executable as appropriate:
# __main__ parses URI as N-Triples:
chmod +x $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/plugins/parsers/ntriples.py
chmod +x %{buildroot}{%{python2_sitelib},%{python3_sitelib}}/rdflib/plugins/parsers/ntriples.py
# __main__ parses the file given on the command line:
chmod +x $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/plugins/parsers/notation3.py
chmod +x %{buildroot}{%{python2_sitelib},%{python3_sitelib}}/rdflib/plugins/parsers/notation3.py
# __main__ parses the file or URI given on the command line:
chmod +x $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/tools/rdfpipe.py
chmod +x %{buildroot}{%{python2_sitelib},%{python3_sitelib}}/rdflib/tools/rdfpipe.py
# __main__ runs a test (well, it's something)
chmod +x $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/extras/infixowl.py
chmod +x %{buildroot}{%{python2_sitelib},%{python3_sitelib}}/rdflib/extras/infixowl.py \
%{buildroot}{%{python2_sitelib},%{python3_sitelib}}/rdflib/extras/external_graph_libs.py
# sed these headers out as they include no __main__
for lib in $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/extras/describer.py \
$RPM_BUILD_ROOT/%{python_sitelib}/rdflib/plugins/parsers/pyRdfa/extras/httpheader.py \
$RPM_BUILD_ROOT/%{python_sitelib}/rdflib/plugins/parsers/structureddata.py; do
for lib in %{buildroot}{%{python2_sitelib},%{python3_sitelib}}/rdflib/extras/describer.py \
%{buildroot}{%{python2_sitelib},%{python3_sitelib}}/rdflib/plugins/parsers/pyRdfa/extras/httpheader.py \
%{buildroot}{%{python2_sitelib},%{python3_sitelib}}/rdflib/plugins/parsers/structureddata.py; do
sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
touch -r $lib $lib.new &&
mv $lib.new $lib
done
# sed shebangs
sed -i '1s=^#!/usr/bin/\(python\|env python\).*=#!%{__python2}=' \
%{buildroot}%{python2_sitelib}/rdflib/extras/infixowl.py \
%{buildroot}%{python2_sitelib}/rdflib/extras/external_graph_libs.py \
%{buildroot}%{python2_sitelib}/rdflib/plugins/parsers/ntriples.py \
%{buildroot}%{python2_sitelib}/rdflib/tools/rdfpipe.py \
%{buildroot}%{python2_sitelib}/rdflib/plugins/parsers/notation3.py
sed -i '1s=^#!/usr/bin/\(python\|env python\).*=#!%{__python3}=' \
%{buildroot}%{python3_sitelib}/rdflib/extras/infixowl.py \
%{buildroot}%{python3_sitelib}/rdflib/extras/external_graph_libs.py \
%{buildroot}%{python3_sitelib}/rdflib/plugins/parsers/ntriples.py \
%{buildroot}%{python3_sitelib}/rdflib/tools/rdfpipe.py \
%{buildroot}%{python3_sitelib}/rdflib/plugins/parsers/notation3.py
%check
%if %{run_tests}
sed -i -e "s|'--with-doctest'|#'--with-doctest'|" run_tests.py
sed -i -e "s|'--doctest-tests'|#'--doctest-tests'|" run_tests.py
sed -i -e "s|with-doctest = 1|#with-doctest = 1|" setup.cfg
PYTHONPATH=./build/lib %{__python} run_tests.py --verbose
PYTHONPATH=./build/lib %{__python2} run_tests.py --verbose
pushd %{py3dir}/build/src
# The python 3 tests are failing, but better to have them here anyway
# TODO investigate the failures
%{__python3} run_tests.py --verbose || :
popd
%endif
%files
%doc LICENSE
%{python_sitelib}/%{pypi_name}
%files -n python2-%{pypi_name}
%license LICENSE
%doc README.md
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info
%{_bindir}/csv2rdf
%{_bindir}/csv2rdf-2*
%{_bindir}/rdf2dot
%{_bindir}/rdf2dot-2*
%{_bindir}/rdfgraphisomorphism
%{_bindir}/rdfgraphisomorphism-2*
%{_bindir}/rdfpipe
%{_bindir}/rdfpipe-2*
%{_bindir}/rdfs2dot
%{_bindir}/rdfs2dot-2*
%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc LICENSE
%license LICENSE
%doc README.md
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
%{_bindir}/python3-csv2rdf
%{_bindir}/python3-rdf2dot
%{_bindir}/python3-rdfgraphisomorphism
%{_bindir}/python3-rdfpipe
%{_bindir}/python3-rdfs2dot
%endif
%{_bindir}/csv2rdf-3*
%{_bindir}/rdf2dot-3*
%{_bindir}/rdfgraphisomorphism-3*
%{_bindir}/rdfpipe-3*
%{_bindir}/rdfs2dot-3*
%changelog
* Tue Jan 03 2017 Miro Hrončok <mhroncok@redhat.com> - 4.2.1-1
- Update to 4.2.1
- Add missing python3 requires (rhbz#1295098)
- Modernize the package (python2 subpackage, %%pyX_* macros..., new versioned executable)
- Run tests on Python 3, even when failing
- Fixed bad shebangs
* Mon Dec 12 2016 Charalampos Stratakis <cstratak@redhat.com> - 4.1.2-8
- Rebuild for Python 3.6

@ -1 +1 @@
a356cf3bdfe1a72d240d151ce5662b84 rdflib-4.1.2.tar.gz
SHA512 (rdflib-4.2.1.tar.gz) = 49145f80a9e027847523faed059c16ec1de358bb9d8fc3ab4fd3bf95a88dd181986b1785deedf6e837cf0b064bd74ab8e27fbb5581e33310353da3546ae7b016

Loading…
Cancel
Save