Louis-Philippe Véronneau pushed to branch master at lintian / lintian
Commits:
-
1147410d
by Maytham Alsudany at 2025-03-19T22:20:11+00:00
3 changed files:
- lib/Lintian/Check/Languages/Python/StdlibDeprecation.pm
- t/recipes/checks/languages/python/stdlib-deprecation/python-imports-distutils/build-spec/orig/import.py
- t/recipes/checks/languages/python/stdlib-deprecation/python-imports-distutils/eval/hints
Changes:
... | ... | @@ -104,7 +104,7 @@ sub visit_patched_files { |
104 | 104 | # does not match "from library2"
|
105 | 105 | # does not match "from notlibrary"
|
106 | 106 | # does not match "from library2.library"
|
107 | - if $line =~ m{^from $library(\s+|\..+)import}
|
|
107 | + if $line =~ m{^\s*from $library(\s+|\..+)import}
|
|
108 | 108 | # import foo, library, bar
|
109 | 109 | # import library
|
110 | 110 | # import library as l
|
... | ... | @@ -117,7 +117,7 @@ sub visit_patched_files { |
117 | 117 | # does not match "import notlibrary"
|
118 | 118 | # does not match "import library2.library"
|
119 | 119 | # does not match "import library2 as library"
|
120 | - ||$line =~ m{^import(\s+|.+,\s?)$library([,.\s]|$)};
|
|
120 | + ||$line =~ m{^\s*import(\s+|.+,\s?)$library([,.\s]|$)};
|
|
121 | 121 | }
|
122 | 122 | |
123 | 123 | }continue {
|
... | ... | @@ -4,6 +4,9 @@ import distutils |
4 | 4 | import foo, bar, distutils.core
|
5 | 5 | import foo, distutils.core, bara
|
6 | 6 | |
7 | +if "this" != "that":
|
|
8 | + import distutils
|
|
9 | + |
|
7 | 10 | # This should not match the uses-deprecated-python-stdlib tag
|
8 | 11 | import distutils2
|
9 | 12 | import notdistutils
|
1 | +python-imports-distutils (source): uses-deprecated-python-stdlib distutils (deprecated in Python 3.10, removed in Python 3.12) [import.py:8]
|
|
1 | 2 | python-imports-distutils (source): uses-deprecated-python-stdlib distutils (deprecated in Python 3.10, removed in Python 3.12) [import.py:5]
|
2 | 3 | python-imports-distutils (source): uses-deprecated-python-stdlib distutils (deprecated in Python 3.10, removed in Python 3.12) [import.py:4]
|
3 | 4 | python-imports-distutils (source): uses-deprecated-python-stdlib distutils (deprecated in Python 3.10, removed in Python 3.12) [import.py:3]
|