Debian Codegraph @

debian/patches/drop-pkg-resources.patch

raw
1 From: Colin Watson <[email protected]>
2 Date: Tue, 22 Sep 2026 16:30:46 +0100
3 Subject: Drop pkg_resources
4
5 Bug-Debian: https://bugs.debian.org/1147770
6 Last-Update: 2026-09-22
7 ---
8 flufl/password/tests/test_documentation.py | 26 ++++++++++++--------------
9 1 file changed, 12 insertions(+), 14 deletions(-)
10
11 diff --git a/flufl/password/tests/test_documentation.py b/flufl/password/tests/test_documentation.py
12 index cf5bc96..08612f1 100644
13 --- a/flufl/password/tests/test_documentation.py
14 +++ b/flufl/password/tests/test_documentation.py
15 @@ -25,13 +25,10 @@ __all__ = [
16 ]
17
18
19 -import os
20 -import atexit
21 import doctest
22 +import importlib.util
23 import unittest
24 -
25 -from pkg_resources import (
26 - resource_filename, resource_exists, resource_listdir, cleanup_resources)
27 +from pathlib import Path
28
29
30 COMMASPACE = ', '
31 @@ -84,18 +81,19 @@ def setup(testobj):
32
33 def additional_tests():
34 "Run the doc tests (README.rst and docs/*, if any exist)"
35 - doctest_files = [
36 - os.path.abspath(resource_filename('flufl.password', 'README.rst'))]
37 - if resource_exists('flufl.password', 'docs'):
38 - for name in resource_listdir('flufl.password', 'docs'):
39 - if name.endswith('.rst'):
40 - doctest_files.append(
41 - os.path.abspath(
42 - resource_filename('flufl.password', 'docs/%s' % name)))
43 + doctest_files = []
44 + spec = importlib.util.find_spec('flufl.password')
45 + if not spec or not spec.submodule_search_locations:
46 + return doctest_files
47 + path = Path(next(iter(spec.submodule_search_locations)))
48 + doctest_files = [str((path / 'README.rst').resolve())]
49 + docs_path = path / 'docs'
50 + for path in docs_path.iterdir():
51 + if path.name.endswith('.rst'):
52 + doctest_files.append(str(path.resolve()))
53 kwargs = dict(module_relative=False,
54 optionflags=DOCTEST_FLAGS,
55 setUp=setup,
56 )
57 - atexit.register(cleanup_resources)
58 return unittest.TestSuite((
59 doctest.DocFileSuite(*doctest_files, **kwargs)))