Github messages for voidlinux
 help / color / mirror / Atom feed
From: Vinfall <Vinfall@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] buku: fix deprecation warning for python3>=3.11
Date: Wed, 16 Nov 2022 04:29:45 +0100	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-40551@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 842 bytes --]

There is a new pull request by Vinfall against master on the void-packages repository

https://github.com/Vinfall/void-packages master
https://github.com/void-linux/void-packages/pull/40551

buku: fix deprecation warning for python3>=3.11
#### Changes

Followup of #40526 and jarun/buku/pull/605.

Add the necessary patch to remove the DeprecationWarning `'cgi' is deprecated and slated for removal in Python 3.13` in buku caused by Python3 version update (3.11 as of writing).

#### Testing the changes
- I tested the changes in this PR: **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)
- I built this PR locally for these architectures:
  - armv6l 
- `xlint` also reports no error.

A patch file from https://github.com/void-linux/void-packages/pull/40551.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-40551.patch --]
[-- Type: text/x-diff, Size: 1962 bytes --]

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)

             reply	other threads:[~2022-11-16  3:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16  3:29 Vinfall [this message]
2022-11-16  7:29 ` classabbyamp
2022-11-16 10:26 ` [PR PATCH] [Closed]: " Vinfall
2022-11-16 10:26 ` [PR PATCH] [Updated] " Vinfall
2022-11-16 10:35 ` Vinfall
2022-11-16 10:36 ` Vinfall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-40551@inbox.vuxu.org \
    --to=vinfall@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).