File: remove-pkg-resources.patch

package info (click to toggle)
gubbins 3.4.3-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 11,008 kB
  • sloc: python: 5,347; ansic: 5,080; sh: 242; makefile: 130; cpp: 27
file content (43 lines) | stat: -rw-r--r-- 1,337 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
Description: get rid of pkg_resources invocations.
 Version information are notably obtained via the now recommended
 importlib.metadata.version function.
Author: Étienne Mollier <emollier@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1125845
Forwarded: no
Last-Update: 2026-01-31
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- gubbins.orig/python/gubbins/__init__.py
+++ gubbins/python/gubbins/__init__.py
@@ -9,7 +9,7 @@
 
 import sys
 import os
-import pkg_resources
+import importlib.metadata
 
 ###############################################################################
 ## Populate the 'gubbins' namespace
@@ -53,11 +53,7 @@
 
 def version():
     os.environ["PATH"] = os.environ["PATH"] + ":/usr/lib/gubbins/"
-    program_version = ""
-    try:
-        program_version = str(pkg_resources.get_distribution(__project__).version)
-    except pkg_resources.RequirementParseError:
-        pass
+    program_version = importlib.metadata.version("gubbins")
     return "%s" % program_version
 
 __version__ = version()
--- gubbins.orig/python/gubbins/tests/test_dependencies.py
+++ gubbins/python/gubbins/tests/test_dependencies.py
@@ -10,7 +10,6 @@
 import sys
 import glob
 import argparse
-import pkg_resources
 import shutil
 from gubbins import common, run_gubbins