[packages/libsoup3] - updated to 3.0.2 - readded Soup gi overrides for now (until it gets merged into pygobject3 release

qboosh qboosh at pld-linux.org
Sun Oct 24 21:41:31 CEST 2021


commit 998c57d23e7a781bbf18b1f5160e3f77e124d05e
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Oct 24 21:46:51 2021 +0200

    - updated to 3.0.2
    - readded Soup gi overrides for now (until it gets merged into pygobject3 release)

 Soup.py       | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 libsoup3.spec |   9 +++--
 2 files changed, 115 insertions(+), 2 deletions(-)
---
diff --git a/libsoup3.spec b/libsoup3.spec
index a9adc7c..acf1d74 100644
--- a/libsoup3.spec
+++ b/libsoup3.spec
@@ -5,12 +5,14 @@
 Summary:	HTTP client/server library for GNOME
 Summary(pl.UTF-8):	Biblioteka klienta/serwera HTTP dla GNOME
 Name:		libsoup3
-Version:	3.0.0
+Version:	3.0.2
 Release:	1
 License:	LGPL v2+
 Group:		Libraries
 Source0:	https://download.gnome.org/sources/libsoup/3.0/libsoup-%{version}.tar.xz
-# Source0-md5:	f1b0caa1c66a4e11c5fced57a3509b89
+# Source0-md5:	b44b22882cb01f8449d189ac18c237dc
+# from libsoup 3.0.0 (waiting for pygobject3 release containing this file)
+Source1:	Soup.py
 Patch0:		%{name}-path-override.patch
 URL:		https://wiki.gnome.org/Projects/libsoup
 BuildRequires:	docbook-dtd412-xml
@@ -141,6 +143,9 @@ rm -rf $RPM_BUILD_ROOT
 
 %ninja_install -C build
 
+install -d $RPM_BUILD_ROOT%{py3_sitedir}/gi/overrides
+cp -p %{SOURCE1} $RPM_BUILD_ROOT%{py3_sitedir}/gi/overrides/Soup.py
+
 %find_lang libsoup-3.0
 
 %clean
diff --git a/Soup.py b/Soup.py
new file mode 100644
index 0000000..0c420c8
--- /dev/null
+++ b/Soup.py
@@ -0,0 +1,108 @@
+#!/usr/bin/env python3
+
+# Copyright (C) 2021 Igalia S.L.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
+# USA
+
+import collections.abc
+
+from ..module import get_introspection_module
+from ..overrides import override
+
+Soup = get_introspection_module('Soup')
+
+__all__ = []
+
+if Soup._version == '3.0':
+
+    class MessageHeadersIter(Soup.MessageHeadersIter):
+
+        def __next__(self):
+            ret, key, value = self.next()
+            if ret is True:
+                return key, value
+            else:
+                raise StopIteration
+
+    @override
+    class MessageHeaders(Soup.MessageHeaders):
+
+        def __getitem__(self, key):
+            if not isinstance(key, str):
+                raise TypeError
+
+            value = self.get_one(key)
+            if value is None:
+                raise KeyError
+
+            return value
+
+        def __delitem__(self, key):
+            if not isinstance(key, str):
+                raise TypeError
+
+            self.remove(key)
+
+        def __setitem__(self, key, value):
+            if not isinstance(key, str) or not isinstance(value, str):
+                raise TypeError
+
+            self.replace(key, value)
+
+        def __contains__(self, item):
+            if not isinstance(item, str):
+                raise TypeError
+
+            return self.get_one(item) is not None
+
+        def __iter__(self):
+            return MessageHeadersIter.init(self)
+
+        def __len__(self):
+            return len(self.keys())
+
+        def keys(self):
+            return [k for k, _ in self]
+
+        def values(self):
+            return [v for _, v in self]
+
+        def items(self):
+            return {k: v for k, v in self}
+
+        def get(self, default=None):
+            return collections.abc.Mapping.get(self, default)
+
+        def pop(self, key):
+            return collections.abc.MutableMapping.pop(self, key)
+
+        def update(self, key, value):
+            return collections.abc.MutableMapping.update(self, key, value)
+
+        def setdefault(self, key, default=None):
+            return collections.abc.MutableMapping.setdefault(self, key, default)
+
+        def popitem(self):
+            return collections.abc.MutableMapping.popitem(self)
+
+    __all__.append('MessageHeaders')
+    __all__.append('MessageHeadersIter')
+    collections.abc.Iterable.register(MessageHeaders)
+    collections.abc.Iterator.register(MessageHeadersIter)
+    collections.abc.Mapping.register(MessageHeaders)
+    collections.abc.MutableMapping.register(MessageHeaders)
+    collections.abc.Container.register(MessageHeaders)
+    collections.abc.Sized.register(MessageHeaders)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libsoup3.git/commitdiff/998c57d23e7a781bbf18b1f5160e3f77e124d05e



More information about the pld-cvs-commit mailing list