gpodder: fix py312 variant, add missing dep

This commit is contained in:
Sergey Fedorov
2024-10-11 16:24:09 +07:00
committed by Renee Otten
parent 80ef452cd4
commit d78f2d5b52
3 changed files with 82 additions and 2 deletions
+10 -2
View File
@@ -42,7 +42,13 @@ variant python38 conflicts python39 python310 python311 python312 description {U
variant python39 conflicts python38 python310 python311 python312 description {Use Python 3.9} {}
variant python310 conflicts python38 python39 python311 python312 description {Use Python 3.10} {}
variant python311 conflicts python38 python39 python310 python312 description {Use Python 3.11} {}
variant python312 conflicts python38 python39 python310 python311 description {Use Python 3.12} {}
variant python312 conflicts python38 python39 python310 python311 description {Use Python 3.12} {
depends_build-append \
port:py${python.version}-setuptools
# https://github.com/gpodder/gpodder/issues/1614
patchfiles-append 510de4b3a0b0444231f87bc6cb60527817847865.patch \
dd9b594d24a541c0f1d3b096e47b6d7f1c11ca7e.patch
}
if {![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} {
default_variants +python312
@@ -70,7 +76,9 @@ depends_lib-append port:dbus-python${python.version} \
port:py${python.version}-mygpoclient \
port:py${python.version}-podcastparser
depends_run-append port:yt-dlp
# ModuleNotFoundError: No module named 'requests'
depends_run-append port:py${python.version}-requests \
port:yt-dlp
post-patch {
reinplace s|python|${my_python}/bin/python|g ${worksrcpath}/makefile
@@ -0,0 +1,28 @@
From 510de4b3a0b0444231f87bc6cb60527817847865 Mon Sep 17 00:00:00 2001
From: auouymous <au@qzx.com>
Date: Tue, 24 Oct 2023 03:39:53 -0600
Subject: [PATCH] Switch from distutils to setuptools.
---
setup.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/setup.py b/setup.py
index 86963fc5c..9eb8ca392 100644
--- setup.py
+++ setup.py
@@ -21,11 +21,12 @@
import os
import re
import sys
-from distutils.core import setup
+
+from setuptools import setup
installing = ('install' in sys.argv and '--help' not in sys.argv)
-# distutils depends on setup.py being executed from the same dir.
+# setuptools depends on setup.py being executed from the same dir.
# Most of our custom commands work either way, but this makes
# it work in all cases.
os.chdir(os.path.dirname(os.path.realpath(__file__)))
@@ -0,0 +1,44 @@
From dd9b594d24a541c0f1d3b096e47b6d7f1c11ca7e Mon Sep 17 00:00:00 2001
From: auouymous <au@qzx.com>
Date: Fri, 20 Oct 2023 03:03:01 -0600
Subject: [PATCH] Replace the removed imp module with importlib.
---
src/gpodder/extensions.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/gpodder/extensions.py b/src/gpodder/extensions.py
index 8f50ff317..44fc35d5d 100644
--- src/gpodder/extensions.py
+++ src/gpodder/extensions.py
@@ -31,7 +31,7 @@
import functools
import glob
-import imp
+import importlib
import logging
import os
import re
@@ -291,15 +291,16 @@ def load_extension(self):
self.name, self.metadata.only_for)
return
- basename, extension = os.path.splitext(os.path.basename(self.filename))
- fp = open(self.filename, 'r')
+ basename, _ = os.path.splitext(os.path.basename(self.filename))
try:
- module_file = imp.load_module(basename, fp, self.filename,
- (extension, 'r', imp.PY_SOURCE))
+ # from load_source() on https://docs.python.org/dev/whatsnew/3.12.html
+ loader = importlib.machinery.SourceFileLoader(basename, self.filename)
+ spec = importlib.util.spec_from_file_location(basename, self.filename, loader=loader)
+ module_file = importlib.util.module_from_spec(spec)
+ loader.exec_module(module_file)
finally:
# Remove the .pyc file if it was created during import
util.delete_file(self.filename + 'c')
- fp.close()
self.default_config = getattr(module_file, 'DefaultConfig', {})
if self.default_config: