python/mkvenv: ensure HAVE_LIB variables are actually constants

Pylint 4.x has refined checking for variable names that behave as
constants vs ones that do not; unfortunately our tricky import machinery
is perceived as these variables being re-assigned.

Add a temporary variable with an underscore and assign to the global
constants precisely once to alleviate this new nag message. Add an
ignore for this name for older versions of pylint that developers may
have installed locally.

(In other words: there is no solution that will cater to both pre- and
post- 4.x versions, so we target 4.x here and silence older versions.)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20251118200657.1043688-2-jsnow@redhat.com>
This commit is contained in:
John Snow
2025-11-18 15:06:55 -05:00
committed by Richard Henderson
parent 5e0242e9a8
commit 9ccd0c8a88
2 changed files with 17 additions and 8 deletions

View File

@@ -159,6 +159,7 @@ good-names=i,
c, # for c in string: ...
T, # for TypeVars. See pylint#3401
SocketAddrT, # Not sure why this is invalid.
_import_ok, # For mkvenv import trickery and compatibility pre-4.x
[pylint.similarities]
# Ignore imports when computing similarities.