Add Python 3.9 compatibility patch (from __future__ import annotations)

This commit is contained in:
Andrew Lukoshko 2026-03-19 13:34:14 +01:00
parent 0e615da492
commit c1e7a2374f
2 changed files with 92 additions and 1 deletions

View File

@ -0,0 +1,87 @@
diff --git a/apt/cdrom.py b/apt/cdrom.py
index dc15c5bb..997082f3 100644
--- a/apt/cdrom.py
+++ b/apt/cdrom.py
@@ -20,6 +20,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
"""Classes related to cdrom handling."""
+from __future__ import annotations
+
import glob
import apt_pkg
diff --git a/apt/debfile.py b/apt/debfile.py
index b3ef7330..8e3967e9 100644
--- a/apt/debfile.py
+++ b/apt/debfile.py
@@ -17,6 +17,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
"""Classes for working with locally available Debian packages."""
+from __future__ import annotations
import gzip
import os
diff --git a/apt/progress/text.py b/apt/progress/text.py
index ea1a176f..0eacb34c 100644
--- a/apt/progress/text.py
+++ b/apt/progress/text.py
@@ -15,6 +15,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
"""Progress reporting for text interfaces."""
+from __future__ import annotations
+
import io
import os
import signal
diff --git a/apt/utils.py b/apt/utils.py
index 5b1fd46a..500ecc04 100644
--- a/apt/utils.py
+++ b/apt/utils.py
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+from __future__ import annotations
+
import datetime
import os
diff --git a/aptsources/_deb822.py b/aptsources/_deb822.py
index 80b732cf..211b9c3f 100644
--- a/aptsources/_deb822.py
+++ b/aptsources/_deb822.py
@@ -5,6 +5,7 @@
# SPDX-License-Identifier: GPL-2.0+
"""deb822 parser with support for comment headers and footers."""
+from __future__ import annotations
import collections
import io
diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py
index 2ee6d7d3..7f9591bd 100644
--- a/aptsources/distinfo.py
+++ b/aptsources/distinfo.py
@@ -20,6 +20,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
+from __future__ import annotations
import csv
import logging
diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py
index dfb80979..f95d53bf 100644
--- a/aptsources/sourceslist.py
+++ b/aptsources/sourceslist.py
@@ -22,6 +22,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
+from __future__ import annotations
import builtins
import glob

View File

@ -3,13 +3,14 @@
Name: python-apt
Version: 3.1.0
Release: 2%{?dist}
Release: 2%{?dist}.alma.1
Summary: Python bindings for APT
# Automatically converted from old format: GPLv2+ - review is highly recommended.
License: GPL-2.0-or-later
URL: https://tracker.debian.org/pkg/python-apt
Source0: https://salsa.debian.org/apt-team/%{name}/-/archive/%{version}/%{name}-%{version}.tar.gz
Patch: python-apt-3.1.0-remove-stubs.patch
Patch: python-apt-3.1.0-fix-python3.9-compat.patch
# Requires Debian's apt
BuildRequires: apt-devel >= 2.0.0
@ -71,6 +72,9 @@ export DEBVER="%{version}"
%{_datadir}/python-apt/
%changelog
* Wed Mar 19 2026 Andrew Lukoshko <alukoshko@almalinux.org> - 3.1.0-2.alma.1
- Add from __future__ import annotations for Python 3.9 compatibility
* Mon Feb 16 2026 Terje Røsten <terjeros@gmail.com> - 3.1.0-2
- Use modern Python macros