Louis-Philippe Véronneau pushed to branch master at lintian / lintian
Commits:
-
d7b05083
by Rebecca N. Palmer at 2024-09-26T12:48:47+00:00
5 changed files:
- lib/Lintian/Check/Languages/Python/StdlibDeprecation.pm
- t/recipes/checks/languages/python/stdlib-deprecation/python-imports-asyncore/build-spec/orig/from.py
- t/recipes/checks/languages/python/stdlib-deprecation/python-imports-asyncore/build-spec/orig/import.py
- t/recipes/checks/languages/python/stdlib-deprecation/python-imports-asyncore/eval/hints
- t/recipes/checks/languages/python/stdlib-deprecation/python-imports-distutils/build-spec/orig/import.py
Changes:
... | ... | @@ -95,18 +95,29 @@ sub visit_patched_files { |
95 | 95 | $library,
|
96 | 96 | "(deprecated in Python $deprecated, removed in Python $removed)"
|
97 | 97 | )
|
98 | + # these do not match relative imports (from .library,
|
|
99 | + # import ..library) on the assumption that those are
|
|
100 | + # probably something package-internal
|
|
101 | + # not the actual stdlib module
|
|
98 | 102 | # from library import foo
|
99 | 103 | # from library.sub import foo
|
100 | - # this also won't match "from library2"
|
|
101 | - if $line =~ m{^from $library(\s||\..+ import)}
|
|
104 | + # does not match "from library2"
|
|
105 | + # does not match "from notlibrary"
|
|
106 | + # does not match "from library2.library"
|
|
107 | + if $line =~ m{^from $library(\s+|\..+)import}
|
|
102 | 108 | # import foo, library, bar
|
103 | - ||$line =~ m{^import.+$library,}
|
|
104 | 109 | # import library
|
110 | + # import library as l
|
|
105 | 111 | # import library.sub
|
112 | + # import library, bar
|
|
106 | 113 | # import foo, library
|
107 | 114 | # import foo, library.sub
|
108 | 115 | # import foo, library.sub, bar
|
109 | - ||$line =~ m{^import.+$library(,||\..+)?$};
|
|
116 | + # does not match "import library2"
|
|
117 | + # does not match "import notlibrary"
|
|
118 | + # does not match "import library2.library"
|
|
119 | + # does not match "import library2 as library"
|
|
120 | + ||$line =~ m{^import(\s+|.+,\s?)$library([,.\s]|$)};
|
|
110 | 121 | }
|
111 | 122 | |
112 | 123 | }continue {
|
... | ... | @@ -5,3 +5,4 @@ from asyncore import socket_map |
5 | 5 | # This should not trigger the uses-deprecated-python-stdlib tag
|
6 | 6 | from ..server.asyncserver import asyncore, RequestHandler, loop, AsyncServer, AsyncServerException
|
7 | 7 | from supervisor.medusa import asyncore_25 as asyncore
|
8 | +from notasyncore import socket_map |
1 | 1 | #!/usr/bin/python3
|
2 | 2 | |
3 | 3 | import asyncore
|
4 | +import asyncore, struct
|
|
4 | 5 | import struct, socket, argparse, asyncore
|
5 | 6 | import struct, asyncore, argparse
|
7 | +import asyncore as ac
|
|
8 | +import struct,asyncore,argparse |
1 | +python-imports-asyncore (source): uses-deprecated-python-stdlib asyncore (deprecated in Python 3.6, removed in Python 3.12) [import.py:8]
|
|
2 | +python-imports-asyncore (source): uses-deprecated-python-stdlib asyncore (deprecated in Python 3.6, removed in Python 3.12) [import.py:7]
|
|
3 | +python-imports-asyncore (source): uses-deprecated-python-stdlib asyncore (deprecated in Python 3.6, removed in Python 3.12) [import.py:6]
|
|
1 | 4 | python-imports-asyncore (source): uses-deprecated-python-stdlib asyncore (deprecated in Python 3.6, removed in Python 3.12) [import.py:5]
|
2 | 5 | python-imports-asyncore (source): uses-deprecated-python-stdlib asyncore (deprecated in Python 3.6, removed in Python 3.12) [import.py:4]
|
3 | 6 | python-imports-asyncore (source): uses-deprecated-python-stdlib asyncore (deprecated in Python 3.6, removed in Python 3.12) [import.py:3]
|
... | ... | @@ -6,3 +6,5 @@ import foo, distutils.core, bara |
6 | 6 | |
7 | 7 | # This should not match the uses-deprecated-python-stdlib tag
|
8 | 8 | import distutils2
|
9 | +import notdistutils
|
|
10 | +import notdistutils as distutils |