Compare commits

...

11 Commits

Author SHA1 Message Date
Fedora Release Engineering 9f2403c1c8 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
6 months ago
Nils Philippsen 1178a8249e Fix testing with pytest 8
7 months ago
Michel Lind 2c9fc7423f
Work around inability to override Pickler/Unpickler methods in Python 3.13
7 months ago
Python Maint 02c04c157a Rebuilt for Python 3.13
7 months ago
Robert-André Mauchin bef7adc9ea Update to 7.0.0
8 months ago
Robert-André Mauchin c9fa0bf1db Convert to %autorelease and %autochangelog
8 months ago
Fedora Release Engineering b688ecc95b Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
12 months ago
Fedora Release Engineering 9e36074467 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
12 months ago
Fedora Release Engineering 9e47bb558f Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
2 years ago
Python Maint 7753bd0e08 Rebuilt for Python 3.12
2 years ago
Fedora Release Engineering 19c415f124 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
2 years ago

1
.gitignore vendored

@ -8,3 +8,4 @@ rdflib-2.4.2.tar.gz
/rdflib-4.2.1.tar.gz
/rdflib-5.0.0.tar.gz
/rdflib-6.2.0.tar.gz
/rdflib-7.0.0.tar.gz

@ -0,0 +1,53 @@
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 6.2.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 6.2.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 6.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 6.2.0-3
- Rebuilt for Python 3.12
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 6.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Tue Aug 30 2022 Simone Caronni <negativo17@gmail.com> - 6.2.0-1
- Update to 6.2.0.
- Update SPEC file.
- Trim changelog.
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue Jul 19 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.0.0-6
- Rebuilt for pyparsing-3.0.9
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 5.0.0-5
- Rebuilt for Python 3.11
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Thu Jun 03 2021 Python Maint <python-maint@redhat.com> - 5.0.0-2
- Rebuilt for Python 3.10
* Mon Feb 15 2021 Dan Callaghan <djc@djc.id.au> - 5.0.0-1
- New upstream release 5.0.0:
https://github.com/RDFLib/rdflib/blob/5.0.0/CHANGELOG.md
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.2.1-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.2.1-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 4.2.1-15
- Rebuilt for Python 3.9
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.2.1-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

@ -1,22 +1,36 @@
%global srcname rdflib
# Tests not compatible with pytest 5+:
%global run_tests 0
%bcond docs 0
%bcond tests 0
%if 0%{?fedora}
%bcond docs 1
%bcond tests 1
%endif
Name: python-%{srcname}
Version: 6.2.0
Release: 1%{?dist}
Version: 7.0.0
Release: %autorelease
Summary: Python library for working with RDF
License: BSD-3-Clause
URL: https://github.com/RDFLib/rdflib
BuildArch: noarch
Source0: %{pypi_source}
Source: %{pypi_source}
Patch: %{srcname}-py3_13-fix-pickler.diff
# Backported from https://github.com/RDFLib/rdflib/pull/2817
Patch: rdflib-7.0.0-pytest8.patch
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
%{?python_enable_dependency_generator}
%if %{with tests}
BuildRequires: python3dist(pytest)
%endif
%if %{with docs}
BuildRequires: python3dist(myst-parser)
BuildRequires: python3dist(sphinx)
BuildRequires: python3dist(sphinx-autodoc-typehints)
BuildRequires: python3dist(sphinxcontrib-apidoc)
BuildRequires: python3dist(typing-extensions)
%endif
%description
RDFLib is a pure Python package for working with RDF. RDFLib contains most
@ -39,21 +53,25 @@ store implementations for in-memory, persistent on disk (Berkeley DB) and
remote SPARQL endpoints, a SPARQL 1.1 implementation - supporting SPARQL 1.1
Queries and Update statements - and SPARQL function extension mechanisms.
%if %{with docs}
%package -n python%{python3_pkgversion}-%{srcname}-docs
Summary: Documentation for %{srcname}
%description -n python%{python3_pkgversion}-%{srcname}-docs
Documentation for %{srcname}, a Python library for working with RDF.
%endif
%prep
%autosetup -p1 -n %{srcname}-%{version}
%generate_buildrequires
%if %{run_tests}
%pyproject_buildrequires -x tests
%else
%pyproject_buildrequires
%endif
%build
%py3_build
%pyproject_wheel
%install
%py3_install
%pyproject_install
# Various .py files within site-packages have a shebang line but aren't
# flagged as executable.
@ -63,19 +81,14 @@ Queries and Update statements - and SPARQL function extension mechanisms.
# __main__ parses URI as N-Triples:
chmod +x %{buildroot}%{python3_sitelib}/rdflib/plugins/parsers/ntriples.py
# __main__ parses the file given on the command line:
chmod +x %{buildroot}%{python3_sitelib}/rdflib/plugins/parsers/notation3.py
# __main__ parses the file or URI given on the command line:
chmod +x %{buildroot}%{python3_sitelib}/rdflib/tools/rdfpipe.py
# __main__ runs a test (well, it's something)
chmod +x %{buildroot}%{python3_sitelib}/rdflib/extras/infixowl.py \
%{buildroot}%{python3_sitelib}/rdflib/extras/external_graph_libs.py
chmod +x %{buildroot}%{python3_sitelib}/rdflib/extras/external_graph_libs.py
# sed these headers out as they include no __main__
for lib in %{buildroot}%{python3_sitelib}/rdflib/extras/describer.py \
%{buildroot}%{python3_sitelib}/rdflib/plugins/parsers/pyRdfa/extras/httpheader.py; do
for lib in %{buildroot}%{python3_sitelib}/rdflib/extras/describer.py; do
sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
touch -r $lib $lib.new &&
mv $lib.new $lib
@ -89,58 +102,38 @@ sed -i '1s=^#!/usr/bin/\(python\|env python\).*=#!%{__python3}=' \
%{buildroot}%{python3_sitelib}/rdflib/tools/rdfpipe.py \
%{buildroot}%{python3_sitelib}/rdflib/plugins/parsers/notation3.py
%if %{with docs}
# generate html docs
PYTHONPATH=%{buildroot}%{python3_sitelib} sphinx-build-3 -b html -d docs/_build/doctree docs docs/_build/html
# remove the sphinx-build-3 leftovers
rm -rf docs/_build/html/.{doctrees,buildinfo}
%endif
%pyproject_save_files -L %{srcname}
%if %{with tests}
%check
%if %{run_tests}
%{__python3} -m pytest
%pytest -k "not rdflib and not rdflib.extras.infixowl and not \
test_example and not test_suite and not \
test_infix_owl_example1 and not test_context and not \
test_service and not test_simple_not_null and not \
test_sparqleval and not test_parser"
%endif
%files -n python3-%{srcname}
%files -n python%{python3_pkgversion}-%{srcname} -f %{pyproject_files}
%license LICENSE
%doc CHANGELOG.md README.md
%{python3_sitelib}/%{srcname}
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info
%doc README.md
%{_bindir}/csv2rdf
%{_bindir}/rdf2dot
%{_bindir}/rdfgraphisomorphism
%{_bindir}/rdfpipe
%{_bindir}/rdfs2dot
%changelog
* Tue Aug 30 2022 Simone Caronni <negativo17@gmail.com> - 6.2.0-1
- Update to 6.2.0.
- Update SPEC file.
- Trim changelog.
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue Jul 19 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.0.0-6
- Rebuilt for pyparsing-3.0.9
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 5.0.0-5
- Rebuilt for Python 3.11
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Thu Jun 03 2021 Python Maint <python-maint@redhat.com> - 5.0.0-2
- Rebuilt for Python 3.10
* Mon Feb 15 2021 Dan Callaghan <djc@djc.id.au> - 5.0.0-1
- New upstream release 5.0.0:
https://github.com/RDFLib/rdflib/blob/5.0.0/CHANGELOG.md
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.2.1-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.2.1-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 4.2.1-15
- Rebuilt for Python 3.9
%if %{with docs}
%files -n python%{python3_pkgversion}-%{srcname}-docs
%license LICENSE
%doc docs/_build/html
%endif
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.2.1-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
%changelog
%autochangelog

@ -0,0 +1,35 @@
diff -up rdflib-7.0.0/test/test_misc/test_parse_file_guess_format.py.pytest8 rdflib-7.0.0/test/test_misc/test_parse_file_guess_format.py
--- rdflib-7.0.0/test/test_misc/test_parse_file_guess_format.py.pytest8 2023-06-01 21:15:21.520171900 +0200
+++ rdflib-7.0.0/test/test_misc/test_parse_file_guess_format.py 2024-07-02 17:45:47.257339626 +0200
@@ -61,7 +61,7 @@ class TestFileParserGuessFormat:
g.parse(os.path.join(TEST_DATA_DIR, "example-lots_of_graphs.n3")), Graph
)
- def test_warning(self) -> None:
+ def test_warning(self, caplog: pytest.LogCaptureFixture) -> None:
g = Graph()
graph_logger = logging.getLogger("rdflib")
@@ -78,9 +78,16 @@ class TestFileParserGuessFormat:
),
str(newpath),
)
- with pytest.raises(ParserError, match=r"Could not guess RDF format"):
- with pytest.warns(
- UserWarning,
- match="does not look like a valid URI, trying to serialize this will break.",
- ) as logwarning:
- g.parse(str(newpath))
+ with pytest.raises(
+ ParserError, match=r"Could not guess RDF format"
+ ), caplog.at_level("WARNING"):
+ g.parse(str(newpath))
+
+ assert any(
+ rec.levelno == logging.WARNING
+ and (
+ "does not look like a valid URI, trying to serialize this will break."
+ in rec.message
+ )
+ for rec in caplog.records
+ )

@ -0,0 +1,64 @@
--- a/rdflib/store.py
+++ b/rdflib/store.py
@@ -113,27 +113,39 @@ class TripleRemovedEvent(Event):
"""
+class _Pickler(Pickler):
+ def __init__(self, file, node):
+ super(_Pickler, self).__init__(file)
+ self._node = node
+
+ def persistent_id(self, key: Any) -> Optional[str]:
+ try:
+ return self._node._ids.get(key)
+ except TypeError:
+ return None
+
+
+class _Unpickler(Unpickler):
+ def __init__(self, file, node):
+ super(_Unpickler, self).__init__(file)
+ self._node = node
+
+ def persistent_load(self, pid):
+ return self._node._get_object(pid)
+
+
class NodePickler:
def __init__(self) -> None:
self._objects: Dict[str, Any] = {}
self._ids: Dict[Any, str] = {}
self._get_object = self._objects.__getitem__
- def _get_ids(self, key: Any) -> Optional[str]:
- try:
- return self._ids.get(key)
- except TypeError:
- return None
-
def register(self, object: Any, id: str) -> None:
self._objects[id] = object
self._ids[object] = id
def loads(self, s: bytes) -> "Node":
- up = Unpickler(BytesIO(s))
- # NOTE on type error: https://github.com/python/mypy/issues/2427
- # type error: Cannot assign to a method
- up.persistent_load = self._get_object # type: ignore[assignment]
+ up = _Unpickler(BytesIO(s), self)
try:
return up.load()
except KeyError as e:
@@ -143,10 +155,7 @@ class NodePickler:
self, obj: "Node", protocol: Optional[Any] = None, bin: Optional[Any] = None
):
src = BytesIO()
- p = Pickler(src)
- # NOTE on type error: https://github.com/python/mypy/issues/2427
- # type error: Cannot assign to a method
- p.persistent_id = self._get_ids # type: ignore[assignment]
+ p = _Pickler(src, self)
p.dump(obj)
return src.getvalue()

@ -1 +1 @@
SHA512 (rdflib-6.2.0.tar.gz) = 7fee5f6df19642ee49039c9072ebc7a9f92bb00f2b5854a7221aba203b32555ff16ec19b76ba86aed1471ee5c5cd8264ade2147435011795b1abf251d1c1bec6
SHA512 (rdflib-7.0.0.tar.gz) = 56d110ab24c74c6ddb2e75320f60a82b4945e6ea1ce9d10ad4ae53d44c679b35826e3d7406e7d0e321ef9b042d32d2ba327a6dbd5c2c1780f552131d80c09445

Loading…
Cancel
Save