From 34453fffdb10d83dd135e9b661530298f70de97a Mon Sep 17 00:00:00 2001 From: Vinfall <91039000+Vinfall@users.noreply.github.com> Date: Wed, 16 Nov 2022 03:26:49 +0000 Subject: [PATCH] buku: fix deprecation warning for python3>=3.11 --- srcpkgs/buku/patches/remove-cgi-warning.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 srcpkgs/buku/patches/remove-cgi-warning.patch diff --git a/srcpkgs/buku/patches/remove-cgi-warning.patch b/srcpkgs/buku/patches/remove-cgi-warning.patch new file mode 100644 index 000000000000..2075e2486431 --- /dev/null +++ b/srcpkgs/buku/patches/remove-cgi-warning.patch @@ -0,0 +1,37 @@ +--- a/buku ++++ b/buku +@@ -19,10 +19,10 @@ + + import argparse + import calendar +-import cgi + import codecs + import collections + import contextlib ++import email.message + import json + import locale + import logging +@@ -3811,15 +3811,17 @@ + if soup.meta and soup.meta.get('charset') is not None: + charset = soup.meta.get('charset') + elif 'content-type' in resp.headers: +- _, params = cgi.parse_header(resp.headers['content-type']) +- if params.get('charset') is not None: +- charset = params.get('charset') ++ m = email.message.Message() ++ m['content-type'] = resp.headers['content-type'] ++ if m.get_param('charset') is not None: ++ charset = m.get_param('charset') + + if not charset and soup: + meta_tag = soup.find('meta', attrs={'http-equiv': 'Content-Type'}) + if meta_tag: +- _, params = cgi.parse_header(meta_tag.attrs['content']) +- charset = params.get('charset', charset) ++ m = email.message.Message() ++ m['content'] = meta_tag.attrs['content'] ++ charset = m.get_param('charset', charset) + + if charset: + LOGDBG('charset: %s', charset)