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
Improve uses-deprecated-python-stdlib
Closes: #1077324
- - - - -
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:
=====================================
lib/Lintian/Check/Languages/Python/StdlibDeprecation.pm
=====================================
@@ -95,18 +95,29 @@ sub visit_patched_files {
$library,
"(deprecated in Python $deprecated, removed in Python $removed)"
)
+ # these do not match relative imports (from .library,
+ # import ..library) on the assumption that those are
+ # probably something package-internal
+ # not the actual stdlib module
# from library import foo
# from library.sub import foo
- # this also won't match "from library2"
- if $line =~ m{^from $library(\s||\..+ import)}
+ # does not match "from library2"
+ # does not match "from notlibrary"
+ # does not match "from library2.library"
+ if $line =~ m{^from $library(\s+|\..+)import}
# import foo, library, bar
- ||$line =~ m{^import.+$library,}
# import library
+ # import library as l
# import library.sub
+ # import library, bar
# import foo, library
# import foo, library.sub
# import foo, library.sub, bar
- ||$line =~ m{^import.+$library(,||\..+)?$};
+ # does not match "import library2"
+ # does not match "import notlibrary"
+ # does not match "import library2.library"
+ # does not match "import library2 as library"
+ ||$line =~ m{^import(\s+|.+,\s?)$library([,.\s]|$)};
}
}continue {
=====================================
t/recipes/checks/languages/python/stdlib-deprecation/python-imports-asyncore/build-spec/orig/from.py
=====================================
@@ -5,3 +5,4 @@ from asyncore import socket_map
# This should not trigger the uses-deprecated-python-stdlib tag
from ..server.asyncserver import asyncore, RequestHandler, loop, AsyncServer,
AsyncServerException
from supervisor.medusa import asyncore_25 as asyncore
+from notasyncore import socket_map
=====================================
t/recipes/checks/languages/python/stdlib-deprecation/python-imports-asyncore/build-spec/orig/import.py
=====================================
@@ -1,5 +1,8 @@
#!/usr/bin/python3
import asyncore
+import asyncore, struct
import struct, socket, argparse, asyncore
import struct, asyncore, argparse
+import asyncore as ac
+import struct,asyncore,argparse
=====================================
t/recipes/checks/languages/python/stdlib-deprecation/python-imports-asyncore/eval/hints
=====================================
@@ -1,3 +1,6 @@
+python-imports-asyncore (source): uses-deprecated-python-stdlib asyncore
(deprecated in Python 3.6, removed in Python 3.12) [import.py:8]
+python-imports-asyncore (source): uses-deprecated-python-stdlib asyncore
(deprecated in Python 3.6, removed in Python 3.12) [import.py:7]
+python-imports-asyncore (source): uses-deprecated-python-stdlib asyncore
(deprecated in Python 3.6, removed in Python 3.12) [import.py:6]
python-imports-asyncore (source): uses-deprecated-python-stdlib asyncore
(deprecated in Python 3.6, removed in Python 3.12) [import.py:5]
python-imports-asyncore (source): uses-deprecated-python-stdlib asyncore
(deprecated in Python 3.6, removed in Python 3.12) [import.py:4]
python-imports-asyncore (source): uses-deprecated-python-stdlib asyncore
(deprecated in Python 3.6, removed in Python 3.12) [import.py:3]
=====================================
t/recipes/checks/languages/python/stdlib-deprecation/python-imports-distutils/build-spec/orig/import.py
=====================================
@@ -6,3 +6,5 @@ import foo, distutils.core, bara
# This should not match the uses-deprecated-python-stdlib tag
import distutils2
+import notdistutils
+import notdistutils as distutils
View it on GitLab:
https://salsa.debian.org/lintian/lintian/-/commit/d7b05083da0115797ef16c7fc166b87f63fd6f89
--
View it on GitLab:
https://salsa.debian.org/lintian/lintian/-/commit/d7b05083da0115797ef16c7fc166b87f63fd6f89
You're receiving this email because of your account on salsa.debian.org.