aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-09-02 13:25:04 -0700
committerEli Schwartz <eschwartz93@gmail.com>2022-09-19 20:57:52 -0400
commit4da14918cd7ad6566f2a986d2dd1aaa87bf66198 (patch)
tree0bfbad0067d9ac015bfe8adb833bfd9cb5a96ce1
parent6f7ea0cc28c9e777c57c74b4d7c2d13604e48ba6 (diff)
downloadmeson-4da14918cd7ad6566f2a986d2dd1aaa87bf66198.zip
meson-4da14918cd7ad6566f2a986d2dd1aaa87bf66198.tar.gz
meson-4da14918cd7ad6566f2a986d2dd1aaa87bf66198.tar.bz2
pylint: enable consider-using-in
-rw-r--r--.pylintrc1
-rw-r--r--mesonbuild/backend/backends.py2
-rw-r--r--mesonbuild/backend/ninjabackend.py2
-rw-r--r--mesonbuild/backend/vs2010backend.py8
-rw-r--r--mesonbuild/cmake/traceparser.py2
-rw-r--r--mesonbuild/compilers/cpp.py2
-rw-r--r--mesonbuild/depfile.py2
-rw-r--r--mesonbuild/environment.py2
-rw-r--r--mesonbuild/mintro.py2
-rw-r--r--mesonbuild/mparser.py2
-rw-r--r--mesonbuild/rewriter.py2
11 files changed, 13 insertions, 14 deletions
diff --git a/.pylintrc b/.pylintrc
index 605cde2..e0790bf 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -14,7 +14,6 @@ disable=
cell-var-from-loop,
consider-merging-isinstance,
consider-using-f-string,
- consider-using-in,
consider-using-max-builtin,
consider-using-min-builtin,
consider-using-with,
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 64c8fa1..53e3530 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -1550,7 +1550,7 @@ class Backend:
outdirs, install_dir_names, custom_install_dir = t.get_install_dir()
# Sanity-check the outputs and install_dirs
num_outdirs, num_out = len(outdirs), len(t.get_outputs())
- if num_outdirs != 1 and num_outdirs != num_out:
+ if num_outdirs not in {1, num_out}:
m = 'Target {!r} has {} outputs: {!r}, but only {} "install_dir"s were found.\n' \
"Pass 'false' for outputs that should not be installed and 'true' for\n" \
'using the default installation directory for an output.'
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 91ecc20..9733465 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -2331,7 +2331,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
deps=deps, depfile=depfile))
def generate_pch_rule_for(self, langname, compiler):
- if langname != 'c' and langname != 'cpp':
+ if langname not in {'c', 'cpp'}:
return
rule = self.compiler_to_pch_rule_name(compiler)
depargs = compiler.get_dependency_gen_args('$out', '$DEPFILE')
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index 0440c3e..fa97720 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -180,13 +180,13 @@ class Vs2010Backend(backends.Backend):
def generate(self):
target_machine = self.interpreter.builtin['target_machine'].cpu_family_method(None, None)
- if target_machine == '64' or target_machine == 'x86_64':
+ if target_machine in {'64', 'x86_64'}:
# amd64 or x86_64
self.platform = 'x64'
elif target_machine == 'x86':
# x86
self.platform = 'Win32'
- elif target_machine == 'aarch64' or target_machine == 'arm64':
+ elif target_machine in {'aarch64', 'arm64'}:
target_cpu = self.interpreter.builtin['target_machine'].cpu_method(None, None)
if target_cpu == 'arm64ec':
self.platform = 'arm64ec'
@@ -198,13 +198,13 @@ class Vs2010Backend(backends.Backend):
raise MesonException('Unsupported Visual Studio platform: ' + target_machine)
build_machine = self.interpreter.builtin['build_machine'].cpu_family_method(None, None)
- if build_machine == '64' or build_machine == 'x86_64':
+ if build_machine in {'64', 'x86_64'}:
# amd64 or x86_64
self.build_platform = 'x64'
elif build_machine == 'x86':
# x86
self.build_platform = 'Win32'
- elif build_machine == 'aarch64' or build_machine == 'arm64':
+ elif build_machine in {'aarch64', 'arm64'}:
target_cpu = self.interpreter.builtin['build_machine'].cpu_method(None, None)
if target_cpu == 'arm64ec':
self.build_platform = 'arm64ec'
diff --git a/mesonbuild/cmake/traceparser.py b/mesonbuild/cmake/traceparser.py
index 1dd636f..d9b5f45 100644
--- a/mesonbuild/cmake/traceparser.py
+++ b/mesonbuild/cmake/traceparser.py
@@ -498,7 +498,7 @@ class CMakeTraceParser:
curr = args.pop(0)
# XXX: APPEND_STRING is specifically *not* supposed to create a
# list, is treating them as aliases really okay?
- if curr == 'APPEND' or curr == 'APPEND_STRING':
+ if curr in {'APPEND', 'APPEND_STRING'}:
append = True
continue
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py
index 2bb1b84..16831c6 100644
--- a/mesonbuild/compilers/cpp.py
+++ b/mesonbuild/compilers/cpp.py
@@ -57,7 +57,7 @@ else:
def non_msvc_eh_options(eh: str, args: T.List[str]) -> None:
if eh == 'none':
args.append('-fno-exceptions')
- elif eh == 's' or eh == 'c':
+ elif eh in {'s', 'c'}:
mlog.warning('non-MSVC compilers do not support ' + eh + ' exception handling.' +
'You may want to set eh to \'default\'.')
diff --git a/mesonbuild/depfile.py b/mesonbuild/depfile.py
index a8b4588..64b973f 100644
--- a/mesonbuild/depfile.py
+++ b/mesonbuild/depfile.py
@@ -33,7 +33,7 @@ def parse(lines: T.Iterable[str]) -> T.List[T.Tuple[T.List[str], T.List[str]]]:
out += c
escape = None
continue
- if c == '\\' or c == '$':
+ if c in {'\\', '$'}:
escape = c
continue
elif c in (' ', '\n'):
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 394b080..bf6d374 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -276,7 +276,7 @@ def detect_windows_arch(compilers: CompilersDict) -> str:
# 32-bit and pretend like we're running under WOW64. Else, return the
# actual Windows architecture that we deduced above.
for compiler in compilers.values():
- if compiler.id == 'msvc' and (compiler.target == 'x86' or compiler.target == '80x86'):
+ if compiler.id == 'msvc' and (compiler.target in {'x86', '80x86'}):
return 'x86'
if compiler.id == 'clang-cl' and compiler.target == 'x86':
return 'x86'
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index affaf9a..154e603 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -323,7 +323,7 @@ def find_buildsystem_files_list(src_dir: str) -> T.List[str]:
filelist = [] # type: T.List[str]
for root, _, files in os.walk(src_dir):
for f in files:
- if f == 'meson.build' or f == 'meson_options.txt':
+ if f in {'meson.build', 'meson_options.txt'}:
filelist.append(os.path.relpath(os.path.join(root, f), src_dir))
return filelist
diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py
index 0995ee8..36590ce 100644
--- a/mesonbuild/mparser.py
+++ b/mesonbuild/mparser.py
@@ -175,7 +175,7 @@ class Lexer:
span_end = loc
bytespan = (span_start, span_end)
match_text = mo.group()
- if tid == 'ignore' or tid == 'comment':
+ if tid in {'ignore', 'comment'}:
break
elif tid == 'lparen':
par_count += 1
diff --git a/mesonbuild/rewriter.py b/mesonbuild/rewriter.py
index 7912fc7..7d4f989 100644
--- a/mesonbuild/rewriter.py
+++ b/mesonbuild/rewriter.py
@@ -399,7 +399,7 @@ class Rewriter:
def check_list(name: str) -> T.List[BaseNode]:
result = []
for i in self.interpreter.targets:
- if name == i['name'] or name == i['id']:
+ if name in {i['name'], i['id']}:
result += [i]
return result