Debian Codegraph @

debian/patches/remove-pkg_resources.patch

raw
1 Description: replace deprecated pkg_resources to importlib.metadata
2 The pkg_resources module is deprecated[1], and obsoleted in the
3 upcoming Python 3.13. This change replaces the use of pkg_resources to
4 obtain the module version from egg info files by importlib.metadata[2],
5 available since Python 3.8.
6 .
7 [1]: https://setuptools.pypa.io/en/latest/pkg_resources.html
8 [2]: https://docs.python.org/3.11/library/importlib.metadata.html#module-importlib.metadata
9 Author: Étienne Mollier <[email protected]>
10 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1083383
11 Forwarded: https://github.com/sanger-pathogens/Fastaq/pull/85
12 Last-Update: 2024-10-16
13 ---
14 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
15 Index: fastaq/pyfastaq/__init__.py
16 ===================================================================
17 --- fastaq.orig/pyfastaq/__init__.py
18 +++ fastaq/pyfastaq/__init__.py
19 @@ -1,9 +1,12 @@
20 -from pkg_resources import get_distribution
21 -
22 try:
23 - __version__ = get_distribution('pyfastaq').version
24 + from importlib.metadata import version
25 + __version__ = version('pyfastaq')
26 except:
27 - __version__ = 'local'
28 + try:
29 + from pkg_resources import get_distribution
30 + __version__ = get_distribution('pyfastaq').version
31 + except:
32 + __version__ = 'local'
33
34
35