From f342efd080678a4c8db1c1e25296923176e821f6 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 22 Sep 2020 09:43:48 -0700 Subject: [PATCH] pylint: turn on bad-indentation error and fix all of the bad indentation --- .pylintrc | 1 + mesonbuild/build.py | 8 +++---- mesonbuild/coredata.py | 2 +- mesonbuild/mesonlib.py | 2 +- mesonbuild/modules/qt.py | 46 ++++++++++++++++++------------------ mesonbuild/optinterpreter.py | 2 +- 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/.pylintrc b/.pylintrc index e9908ba53..2ff8c5634 100644 --- a/.pylintrc +++ b/.pylintrc @@ -9,6 +9,7 @@ disable=all enable= abstract-class-instantiated, assert-on-tuple, + bad-indentation, compare-to-zero, dangerous-default-value, deprecated-lambda, diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 30fa77a5e..be9763489 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -462,10 +462,10 @@ a hard error in the future.'''.format(name)) for k, v in option_overrides.items(): if '_' in k: - lang, k2 = k.split('_', 1) - if lang in all_languages: - self.option_overrides_compiler[lang][k2] = v - continue + lang, k2 = k.split('_', 1) + if lang in all_languages: + self.option_overrides_compiler[lang][k2] = v + continue self.option_overrides_base[k] = v def parse_overrides(self, kwargs) -> dict: diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index bba394280..a36bbe974 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -771,7 +771,7 @@ class CoreData: lang, key = k.split('_', 1) for machine in MachineChoice: if key not in env.compiler_options[machine][lang]: - env.compiler_options[machine][lang][key] = v + env.compiler_options[machine][lang][key] = v elif k in base_options: if not subproject and k not in env.base_options: env.base_options[k] = v diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index c6cbbd638..dd2fe8e70 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -946,7 +946,7 @@ def do_define(regex: T.Pattern[str], line: str, confdata: 'ConfigurationData', v arr = line.split() if variable_format == 'meson' and len(arr) != 2: - raise MesonException('#mesondefine does not contain exactly two tokens: %s' % line.strip()) + raise MesonException('#mesondefine does not contain exactly two tokens: %s' % line.strip()) varname = arr[1] try: diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py index c7a1c4651..32ff6afe7 100644 --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -87,29 +87,29 @@ class QtBaseModule(ExtensionModule): rcc_dirname, nodes = self.qrc_nodes(state, rcc_file) result = [] for resource_path in nodes: - # We need to guess if the pointed resource is: - # a) in build directory -> implies a generated file - # b) in source directory - # c) somewhere else external dependency file to bundle - # - # Also from qrc documentation: relative path are always from qrc file - # So relative path must always be computed from qrc file ! - if os.path.isabs(resource_path): - # a) - if resource_path.startswith(os.path.abspath(state.environment.build_dir)): - resource_relpath = os.path.relpath(resource_path, state.environment.build_dir) - result.append(File(is_built=True, subdir='', fname=resource_relpath)) - # either b) or c) - else: - result.append(File(is_built=False, subdir=state.subdir, fname=resource_path)) - else: - path_from_rcc = os.path.normpath(os.path.join(rcc_dirname, resource_path)) - # a) - if path_from_rcc.startswith(state.environment.build_dir): - result.append(File(is_built=True, subdir=state.subdir, fname=resource_path)) - # b) - else: - result.append(File(is_built=False, subdir=state.subdir, fname=path_from_rcc)) + # We need to guess if the pointed resource is: + # a) in build directory -> implies a generated file + # b) in source directory + # c) somewhere else external dependency file to bundle + # + # Also from qrc documentation: relative path are always from qrc file + # So relative path must always be computed from qrc file ! + if os.path.isabs(resource_path): + # a) + if resource_path.startswith(os.path.abspath(state.environment.build_dir)): + resource_relpath = os.path.relpath(resource_path, state.environment.build_dir) + result.append(File(is_built=True, subdir='', fname=resource_relpath)) + # either b) or c) + else: + result.append(File(is_built=False, subdir=state.subdir, fname=resource_path)) + else: + path_from_rcc = os.path.normpath(os.path.join(rcc_dirname, resource_path)) + # a) + if path_from_rcc.startswith(state.environment.build_dir): + result.append(File(is_built=True, subdir=state.subdir, fname=resource_path)) + # b) + else: + result.append(File(is_built=False, subdir=state.subdir, fname=path_from_rcc)) return result @noPosargs diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py index 75011e7d0..ec329a837 100644 --- a/mesonbuild/optinterpreter.py +++ b/mesonbuild/optinterpreter.py @@ -210,7 +210,7 @@ class OptionInterpreter: (posargs, kwargs) = self.reduce_arguments(node.args) if 'yield' in kwargs: - FeatureNew.single_use('option yield', '0.45.0', self.subproject) + FeatureNew.single_use('option yield', '0.45.0', self.subproject) if 'type' not in kwargs: raise OptionException('Option call missing mandatory "type" keyword argument')