mirror of
https://github.com/void-linux/void-packages.git
synced 2025-07-30 01:12:58 +02:00
buku: fix cgi deprecation warning for python3>=3.11
This commit is contained in:
parent
99a21dfb52
commit
4ad2f171db
2 changed files with 39 additions and 1 deletions
38
srcpkgs/buku/patches/remove-cgi-warning.patch
Normal file
38
srcpkgs/buku/patches/remove-cgi-warning.patch
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
adapted from https://github.com/jarun/buku/pull/605
|
||||||
|
--- 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)
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'buku'
|
# Template file for 'buku'
|
||||||
pkgname=buku
|
pkgname=buku
|
||||||
version=4.7
|
version=4.7
|
||||||
revision=1
|
revision=2
|
||||||
depends="python3-urllib3 python3-BeautifulSoup4 python3-cryptography
|
depends="python3-urllib3 python3-BeautifulSoup4 python3-cryptography
|
||||||
python3-html5lib"
|
python3-html5lib"
|
||||||
short_desc="Cmdline bookmark management utility"
|
short_desc="Cmdline bookmark management utility"
|
||||||
|
|
Loading…
Add table
Reference in a new issue