commit 53cf3ff41f792f4fe51637966b5e4ce7254d8d01 Author: MSVSphere Packaging Team Date: Mon Dec 23 13:47:22 2024 +0300 import python-rdflib-7.0.0-5.el10 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6313629 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/rdflib-7.0.0.tar.gz diff --git a/.python-rdflib.metadata b/.python-rdflib.metadata new file mode 100644 index 0000000..864f7bc --- /dev/null +++ b/.python-rdflib.metadata @@ -0,0 +1 @@ +f0de113d8bbd1e761ff8d181e1dcdee997fa92fd SOURCES/rdflib-7.0.0.tar.gz diff --git a/SOURCES/rdflib-7.0.0-pytest8.patch b/SOURCES/rdflib-7.0.0-pytest8.patch new file mode 100644 index 0000000..9a052f3 --- /dev/null +++ b/SOURCES/rdflib-7.0.0-pytest8.patch @@ -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 ++ ) diff --git a/SOURCES/rdflib-py3_13-fix-pickler.diff b/SOURCES/rdflib-py3_13-fix-pickler.diff new file mode 100644 index 0000000..d2fbf49 --- /dev/null +++ b/SOURCES/rdflib-py3_13-fix-pickler.diff @@ -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() + diff --git a/SPECS/python-rdflib.spec b/SPECS/python-rdflib.spec new file mode 100644 index 0000000..a468210 --- /dev/null +++ b/SPECS/python-rdflib.spec @@ -0,0 +1,226 @@ +## START: Set by rpmautospec +## (rpmautospec version 0.7.2) +## RPMAUTOSPEC: autorelease, autochangelog +%define autorelease(e:s:pb:n) %{?-p:0.}%{lua: + release_number = 5; + base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); + print(release_number + base_release_number - 1); +}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} +## END: Set by rpmautospec + +%global srcname rdflib + +%bcond docs 0 +%bcond tests 0 +%if 0%{?fedora} +%bcond docs 1 +%bcond tests 1 +%endif + +Name: python-%{srcname} +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 + +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 +%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 +things you need to work with RDF, including parsers and serializers for +RDF/XML, N3, NTriples, N-Quads, Turtle, TriX, Trig and JSON-LD, a Graph +interface which can be backed by any one of a number of Store implementations, +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. + +%package -n python%{python3_pkgversion}-%{srcname} +Summary: %{summary} + +%description -n python%{python3_pkgversion}-%{srcname} +RDFLib is a pure Python package for working with RDF. RDFLib contains most +things you need to work with RDF, including parsers and serializers for +RDF/XML, N3, NTriples, N-Quads, Turtle, TriX, Trig and JSON-LD, a Graph +interface which can be backed by any one of a number of Store implementations, +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 +%pyproject_buildrequires + +%build +%pyproject_wheel + +%install +%pyproject_install + +# 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: + +# __main__ parses URI as N-Triples: +chmod +x %{buildroot}%{python3_sitelib}/rdflib/plugins/parsers/ntriples.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/external_graph_libs.py + +# sed these headers out as they include no __main__ +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 +done + +# sed shebangs +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 + +%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 +%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 python%{python3_pkgversion}-%{srcname} -f %{pyproject_files} +%license LICENSE +%doc README.md +%{_bindir}/csv2rdf +%{_bindir}/rdf2dot +%{_bindir}/rdfgraphisomorphism +%{_bindir}/rdfpipe +%{_bindir}/rdfs2dot + +%if %{with docs} +%files -n python%{python3_pkgversion}-%{srcname}-docs +%license LICENSE +%doc docs/_build/html +%endif + +%changelog +* Mon Dec 23 2024 MSVSphere Packaging Team - 7.0.0-5 +- Rebuilt for MSVSphere 10 + +## START: Generated by rpmautospec +* Fri Jul 19 2024 Fedora Release Engineering - 7.0.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Tue Jul 02 2024 Nils Philippsen - 7.0.0-4 +- Fix testing with pytest 8 + +* Thu Jun 13 2024 Michel Lind - 7.0.0-3 +- Work around inability to override Pickler/Unpickler methods in Python + 3.13 + +* Sun Jun 09 2024 Python Maint - 7.0.0-2 +- Rebuilt for Python 3.13 + +* Sat May 25 2024 Robert-André Mauchin - 7.0.0-1 +- Update to 7.0.0 +- Use current Python macros +- Run tests +- Build docs + +* Fri Jan 26 2024 Fedora Release Engineering - 6.2.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Jan 22 2024 Fedora Release Engineering - 6.2.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jul 21 2023 Fedora Release Engineering - 6.2.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Tue Jun 13 2023 Python Maint - 6.2.0-3 +- Rebuilt for Python 3.12 + +* Fri Jan 20 2023 Fedora Release Engineering - 6.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Tue Aug 30 2022 Simone Caronni - 6.2.0-1 +- Update to 6.2.0. +- Update SPEC file. +- Trim changelog. + +* Fri Jul 22 2022 Fedora Release Engineering - 5.0.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Tue Jul 19 2022 Zbigniew Jędrzejewski-Szmek - 5.0.0-6 +- Rebuilt for pyparsing-3.0.9 + +* Mon Jun 13 2022 Python Maint - 5.0.0-5 +- Rebuilt for Python 3.11 + +* Fri Jan 21 2022 Fedora Release Engineering - 5.0.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Fri Jul 23 2021 Fedora Release Engineering - 5.0.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Thu Jun 03 2021 Python Maint - 5.0.0-2 +- Rebuilt for Python 3.10 + +* Mon Feb 15 2021 Dan Callaghan - 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 - 4.2.1-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Jul 29 2020 Fedora Release Engineering - 4.2.1-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Sat May 23 2020 Miro Hrončok - 4.2.1-15 +- Rebuilt for Python 3.9 + +* Thu Jan 30 2020 Fedora Release Engineering - 4.2.1-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +## END: Generated by rpmautospec