File: pkg_resources.patch

package info (click to toggle)
afew 3.0.1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 684 kB
  • sloc: python: 1,484; makefile: 10; sh: 6
file content (49 lines) | stat: -rw-r--r-- 1,559 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From fe0ea03ff168927104eec31c3586cce6892e0119 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Tue, 4 Nov 2025 21:24:56 +0100
Subject: [PATCH] Migrate from deprecated pkg_resources to importlib.metadata

The pkg_resources module is deprecated and slated for removal in setuptools 81 (as early as 2025-11-30).
This change eliminates UserWarning messages during afew execution by using the modern importlib.metadata API,
which has been available since Python 3.8.

--- a/afew/FilterRegistry.py
+++ b/afew/FilterRegistry.py
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: ISC
 # Copyright (c) Justus Winter <4winter@informatik.uni-hamburg.de>
 
-import pkg_resources
+from importlib.metadata import entry_points
 
 RAISEIT = object()
 
@@ -51,7 +51,7 @@
         return self.filter.items()
 
 
-all_filters = FilterRegistry(pkg_resources.iter_entry_points('afew.filter'))
+all_filters = FilterRegistry(entry_points(group='afew.filter'))
 
 
 def register_filter(klass):
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -14,7 +14,7 @@
 
 import sys
 import os
-from pkg_resources import get_distribution
+from importlib.metadata import version
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
@@ -74,7 +74,7 @@
 if pretended_version:
     release = pretended_version
 else:
-    release = get_distribution('afew').version
+    release = version('afew')
 # The X.Y.Z version.
 version = '.'.join(release.split('.')[:3])