summaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorIgor Gnatenko <i.gnatenko.brain@gmail.com>2016-12-19 21:48:35 +0100
committerIgor Gnatenko <i.gnatenko.brain@gmail.com>2016-12-19 21:48:35 +0100
commit139e020ede8a954a276e69d5c1921884ef9725ce (patch)
tree2934fa9d848640eb057b1672e947217836aab47a /mesonbuild
parent9ffc0d2f894c78d6d0acab9001d9e8a0db05d9b0 (diff)
downloadmeson-139e020ede8a954a276e69d5c1921884ef9725ce.tar.gz
tree-wide: use proper 'not in' notation
Let's be more pythonic and 'not is' seems really weird. Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py6
-rw-r--r--mesonbuild/build.py6
-rw-r--r--mesonbuild/dependencies.py2
-rw-r--r--mesonbuild/environment.py4
-rw-r--r--mesonbuild/interpreter.py18
-rw-r--r--mesonbuild/mconf.py4
-rw-r--r--mesonbuild/modules/gnome.py4
-rw-r--r--mesonbuild/modules/i18n.py2
-rw-r--r--mesonbuild/optinterpreter.py2
9 files changed, 24 insertions, 24 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 4a85327da..d8fb73205 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -268,7 +268,7 @@ int dummy;
return False
suffix = os.path.splitext(source)[1][1:]
for lang in self.langs_cant_unity:
- if not lang in target.compilers:
+ if lang not in target.compilers:
continue
if suffix in target.compilers[lang].file_suffixes:
return False
@@ -433,7 +433,7 @@ int dummy;
def process_target_dependencies(self, target, outfile):
for t in target.get_dependencies():
tname = t.get_basename() + t.type_suffix()
- if not tname in self.processed_targets:
+ if tname not in self.processed_targets:
self.generate_target(t, outfile)
def custom_target_generator_inputs(self, target, outfile):
@@ -2076,7 +2076,7 @@ rule FORTRAN_DEP_HACK
result = []
for ld in link_deps:
prospective = self.get_target_dir(ld)
- if not prospective in result:
+ if prospective not in result:
result.append(prospective)
return result
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 47d589db0..136bcf5f7 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -315,7 +315,7 @@ class BuildTarget():
def check_unknown_kwargs_int(self, kwargs, known_kwargs):
unknowns = []
for k in kwargs:
- if not k in known_kwargs:
+ if k not in known_kwargs:
unknowns.append(k)
if len(unknowns) > 0:
mlog.warning('Unknown keyword argument(s) in target %s: %s.' %
@@ -347,7 +347,7 @@ class BuildTarget():
if hasattr(s, 'held_object'):
s = s.held_object
if isinstance(s, File):
- if not s in added_sources:
+ if s not in added_sources:
self.sources.append(s)
added_sources[s] = True
elif isinstance(s, (GeneratedList, CustomTarget)):
@@ -874,7 +874,7 @@ class Generator():
for rule in outputs:
if not isinstance(rule, str):
raise InvalidArguments('"output" may only contain strings.')
- if not '@BASENAME@' in rule and not '@PLAINNAME@' in rule:
+ if '@BASENAME@' not in rule and '@PLAINNAME@' not in rule:
raise InvalidArguments('Every element of "output" must contain @BASENAME@ or @PLAINNAME@.')
if '/' in rule or '\\' in rule:
raise InvalidArguments('"outputs" must not contain a directory separator.')
diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py
index ba70f4e4d..1d3e4890f 100644
--- a/mesonbuild/dependencies.py
+++ b/mesonbuild/dependencies.py
@@ -345,7 +345,7 @@ class WxDependency(Dependency):
def get_requested(self, kwargs):
modules = 'modules'
- if not modules in kwargs:
+ if modules not in kwargs:
return []
candidates = kwargs[modules]
if isinstance(candidates, str):
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 3231fa858..6217734a3 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -830,9 +830,9 @@ class CrossBuildInfo():
self.parse_datafile(filename)
if 'target_machine' in self.config:
return
- if not 'host_machine' in self.config:
+ if 'host_machine' not in self.config:
raise mesonlib.MesonException('Cross info file must have either host or a target machine.')
- if not 'binaries' in self.config:
+ if 'binaries' not in self.config:
raise mesonlib.MesonException('Cross file is missing "binaries".')
def ok_type(self, i):
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index a62e1815b..b5303529c 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1278,7 +1278,7 @@ class Interpreter(InterpreterBase):
if len(args) != 1:
raise InvalidCode('Import takes one argument.')
modname = args[0]
- if not modname in self.environment.coredata.modules:
+ if modname not in self.environment.coredata.modules:
module = importlib.import_module('mesonbuild.modules.' + modname).initialize()
self.environment.coredata.modules[modname] = module
return ModuleHolder(modname, self.environment.coredata.modules[modname], self)
@@ -1509,7 +1509,7 @@ class Interpreter(InterpreterBase):
self.add_languages(args[1:], True)
langs = self.coredata.compilers.keys()
if 'vala' in langs:
- if not 'c' in langs:
+ if 'c' not in langs:
raise InterpreterException('Compiling Vala requires C. Add C to your project languages and rerun Meson.')
if not self.is_subproject():
self.check_cross_stdlibs()
@@ -1876,7 +1876,7 @@ requirements use the version keyword argument instead.''')
all_args = args[1:]
deps = []
elif len(args) == 1:
- if not 'command' in kwargs:
+ if 'command' not in kwargs:
raise InterpreterException('Missing "command" keyword argument')
all_args = kwargs['command']
if not isinstance(all_args, list):
@@ -2054,7 +2054,7 @@ requirements use the version keyword argument instead.''')
def func_install_subdir(self, node, args, kwargs):
if len(args) != 1:
raise InvalidArguments('Install_subdir requires exactly one argument.')
- if not 'install_dir' in kwargs:
+ if 'install_dir' not in kwargs:
raise InvalidArguments('Missing keyword argument install_dir')
install_dir = kwargs['install_dir']
if not isinstance(install_dir, str):
@@ -2066,7 +2066,7 @@ requirements use the version keyword argument instead.''')
def func_configure_file(self, node, args, kwargs):
if len(args) > 0:
raise InterpreterException("configure_file takes only keyword arguments.")
- if not 'output' in kwargs:
+ if 'output' not in kwargs:
raise InterpreterException('Required keyword argument "output" not defined.')
inputfile = kwargs.get('input', None)
output = kwargs['output']
@@ -2137,7 +2137,7 @@ requirements use the version keyword argument instead.''')
'been declared.\nThis is not permitted. Please declare all ' \
'global arguments before your targets.'
raise InvalidCode(msg)
- if not 'language' in kwargs:
+ if 'language' not in kwargs:
raise InvalidCode('Missing language definition in add_global_arguments')
lang = kwargs['language'].lower()
if lang in self.build.global_args:
@@ -2160,7 +2160,7 @@ requirements use the version keyword argument instead.''')
'been declared.\nThis is not permitted. Please declare all ' \
'global arguments before your targets.'
raise InvalidCode(msg)
- if not 'language' in kwargs:
+ if 'language' not in kwargs:
raise InvalidCode('Missing language definition in add_global_link_arguments')
lang = kwargs['language'].lower()
if lang in self.build.global_link_args:
@@ -2175,7 +2175,7 @@ requirements use the version keyword argument instead.''')
'been declared.\nThis is not permitted. Please declare all ' \
'project link arguments before your targets.'
raise InvalidCode(msg)
- if not 'language' in kwargs:
+ if 'language' not in kwargs:
raise InvalidCode('Missing language definition in add_project_link_arguments')
lang = kwargs['language'].lower()
if self.subproject not in self.build.projects_link_args:
@@ -2192,7 +2192,7 @@ requirements use the version keyword argument instead.''')
'project arguments before your targets.'
raise InvalidCode(msg)
- if not 'language' in kwargs:
+ if 'language' not in kwargs:
raise InvalidCode('Missing language definition in add_project_arguments')
if self.subproject not in self.build.projects_args:
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py
index 2db4d378f..027dd5830 100644
--- a/mesonbuild/mconf.py
+++ b/mesonbuild/mconf.py
@@ -104,7 +104,7 @@ class Conf:
tgt.set_value(v)
elif k.endswith('_link_args'):
lang = k[:-10]
- if not lang in self.coredata.external_link_args:
+ if lang not in self.coredata.external_link_args:
raise ConfException('Unknown language %s in linkargs.' % lang)
# TODO, currently split on spaces, make it so that user
# can pass in an array string.
@@ -112,7 +112,7 @@ class Conf:
self.coredata.external_link_args[lang] = newvalue
elif k.endswith('_args'):
lang = k[:-5]
- if not lang in self.coredata.external_args:
+ if lang not in self.coredata.external_args:
raise ConfException('Unknown language %s in compile args' % lang)
# TODO same fix as above
newvalue = v.split()
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 3a991e9d5..b093dd5fe 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -639,7 +639,7 @@ can not be used with the current version of glib-compiled-resources, due to
modulename = args[0]
if not isinstance(modulename, str):
raise MesonException('Gtkdoc arg must be string.')
- if not 'src_dir' in kwargs:
+ if 'src_dir' not in kwargs:
raise MesonException('Keyword argument src_dir missing.')
main_file = kwargs.get('main_sgml', '')
if not isinstance(main_file, str):
@@ -657,7 +657,7 @@ can not be used with the current version of glib-compiled-resources, due to
namespace = kwargs.get('namespace', '')
mode = kwargs.get('mode', 'auto')
VALID_MODES = ('xml', 'sgml', 'none', 'auto')
- if not mode in VALID_MODES:
+ if mode not in VALID_MODES:
raise MesonException('gtkdoc: Mode {} is not a valid mode: {}'.format(mode, VALID_MODES))
src_dirs = kwargs['src_dir']
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py
index eaeb0a3b7..a16154552 100644
--- a/mesonbuild/modules/i18n.py
+++ b/mesonbuild/modules/i18n.py
@@ -53,7 +53,7 @@ class I18nModule:
file_type = kwargs.pop('type', 'xml')
VALID_TYPES = ('xml', 'desktop')
- if not file_type in VALID_TYPES:
+ if file_type not in VALID_TYPES:
raise MesonException('i18n: "{}" is not a valid type {}'.format(file_type, VALID_TYPES))
kwargs['command'] = ['msgfmt', '--' + file_type,
diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py
index 4fe0843dc..99085e382 100644
--- a/mesonbuild/optinterpreter.py
+++ b/mesonbuild/optinterpreter.py
@@ -130,7 +130,7 @@ class OptionInterpreter:
if 'type' not in kwargs:
raise OptionException('Option call missing mandatory "type" keyword argument')
opt_type = kwargs['type']
- if not opt_type in option_types:
+ if opt_type not in option_types:
raise OptionException('Unknown type %s.' % opt_type)
if len(posargs) != 1:
raise OptionException('Option() must have one (and only one) positional argument')