aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-09-02 16:23:18 -0700
committerEli Schwartz <eschwartz@archlinux.org>2022-11-29 23:26:05 -0500
commit5794805f8e76dfe940f6c09d080d9068fe1ff98d (patch)
treeb85c458fafca27c878a36db544c2ccaa9a5c4e23
parente8727fc8571bc8b9dc23255c267b52478d12e66f (diff)
downloadmeson-5794805f8e76dfe940f6c09d080d9068fe1ff98d.zip
meson-5794805f8e76dfe940f6c09d080d9068fe1ff98d.tar.gz
meson-5794805f8e76dfe940f6c09d080d9068fe1ff98d.tar.bz2
pylint: enable used-before-assignment
The one case of this was a false-positive, but what we were doing (checking locals()) is not idiomatic. I've replaced the call to `locals()` with the obvious `var: T.Optional[str] = None` with check instead.
-rw-r--r--.pylintrc1
-rw-r--r--mesonbuild/msetup.py4
2 files changed, 3 insertions, 2 deletions
diff --git a/.pylintrc b/.pylintrc
index 6245958..45fec9b 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -74,7 +74,6 @@ disable=
unused-argument,
unused-variable,
use-implicit-booleaness-not-comparison,
- used-before-assignment,
useless-return,
useless-super-delegation,
wrong-import-order,
diff --git a/mesonbuild/msetup.py b/mesonbuild/msetup.py
index 7c452d4..43594dd 100644
--- a/mesonbuild/msetup.py
+++ b/mesonbuild/msetup.py
@@ -231,6 +231,8 @@ class MesonApp:
except Exception as e:
mintro.write_meson_info_file(b, [e])
raise
+
+ cdf: T.Optional[str] = None
try:
dumpfile = os.path.join(env.get_scratch_dir(), 'build.dat')
# We would like to write coredata as late as possible since we use the existence of
@@ -281,7 +283,7 @@ class MesonApp:
except Exception as e:
mintro.write_meson_info_file(b, [e])
- if 'cdf' in locals():
+ if cdf is not None:
old_cdf = cdf + '.prev'
if os.path.exists(old_cdf):
os.replace(old_cdf, cdf)