Files
termux-packages/packages/python-apt/0002-import-apt_pkg-warning-and-export-it-again.patch
2023-12-24 14:31:12 +00:00

48 lines
1.6 KiB
Diff

https://salsa.debian.org/apt-team/python-apt/-/commit/c64748b17f875ae16783755122064e5abdc0cf0c
From c64748b17f875ae16783755122064e5abdc0cf0c Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <jak@debian.org>
Date: Thu, 21 Dec 2023 15:53:30 +0100
Subject: [PATCH] apt_inst: Import apt_pkg.Warning and export it again
Like apt_pkg.Error, we need to also proxy apt_pkg.Warning, and
specifically the PyAptWarning variable needs to be declared and
initialized with the object from apt_pkg as otherwise we get a
missing symbol from dlopen()
Fixes: 81a5896ee410c62ccf140b48142a5358a07331ca
("Issue warnings as apt_pkg.Warning instead of discarding when
there is no error")
Closes: #1058657
---
python/apt_instmodule.cc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/python/apt_instmodule.cc b/python/apt_instmodule.cc
index 1b30d606..eb010747 100644
--- a/python/apt_instmodule.cc
+++ b/python/apt_instmodule.cc
@@ -24,6 +24,7 @@
/*}}}*/
PyObject *PyAptError;
+PyObject *PyAptWarning;
static PyMethodDef *methods = 0;
@@ -70,8 +71,12 @@ extern "C" void initapt_inst()
PyAptError = PyObject_GetAttrString(apt_pkg, "Error");
if (PyAptError == NULL)
INIT_ERROR;
+ PyAptWarning = PyObject_GetAttrString(apt_pkg, "Warning");
+ if (PyAptWarning == NULL)
+ INIT_ERROR;
PyModule_AddObject(module,"Error",PyAptError);
+ PyModule_AddObject(module,"Warning",PyAptWarning);
ADDTYPE(module,"ArMember",&PyArMember_Type);
ADDTYPE(module,"ArArchive",&PyArArchive_Type);
ADDTYPE(module,"DebFile",&PyDebFile_Type);
--
GitLab