Debian Codegraph @

debian/patches/pkg_resources.patch

raw
1 From fe0ea03ff168927104eec31c3586cce6892e0119 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <[email protected]>
3 Date: Tue, 4 Nov 2025 21:24:56 +0100
4 Subject: [PATCH] Migrate from deprecated pkg_resources to importlib.metadata
5
6 The pkg_resources module is deprecated and slated for removal in setuptools 81 (as early as 2025-11-30).
7 This change eliminates UserWarning messages during afew execution by using the modern importlib.metadata API,
8 which has been available since Python 3.8.
9
10 --- a/afew/FilterRegistry.py
11 +++ b/afew/FilterRegistry.py
12 @@ -1,7 +1,7 @@
13 # SPDX-License-Identifier: ISC
14 # Copyright (c) Justus Winter <[email protected]>
15
16 -import pkg_resources
17 +from importlib.metadata import entry_points
18
19 RAISEIT = object()
20
21 @@ -51,7 +51,7 @@
22 return self.filter.items()
23
24
25 -all_filters = FilterRegistry(pkg_resources.iter_entry_points('afew.filter'))
26 +all_filters = FilterRegistry(entry_points(group='afew.filter'))
27
28
29 def register_filter(klass):
30 --- a/docs/conf.py
31 +++ b/docs/conf.py
32 @@ -14,7 +14,7 @@
33
34 import sys
35 import os
36 -from pkg_resources import get_distribution
37 +from importlib.metadata import version
38
39 # If extensions (or modules to document with autodoc) are in another directory,
40 # add these directories to sys.path here. If the directory is relative to the
41 @@ -74,7 +74,7 @@
42 if pretended_version:
43 release = pretended_version
44 else:
45 - release = get_distribution('afew').version
46 + release = version('afew')
47 # The X.Y.Z version.
48 version = '.'.join(release.split('.')[:3])
49