diff --git a/mesonbuild/_typing.py b/mesonbuild/_typing.py index 31a6e18b6..7616ad600 100644 --- a/mesonbuild/_typing.py +++ b/mesonbuild/_typing.py @@ -55,7 +55,7 @@ class ImmutableListProtocol(Protocol[T]): def __iter__(self) -> typing.Iterator[T]: ... @typing.overload - def __getitem__(self, index: int) -> T:... + def __getitem__(self, index: int) -> T: ... @typing.overload def __getitem__(self, index: slice) -> typing.List[T]: ... diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 3a9b03827..3e549e120 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -830,7 +830,7 @@ class NinjaBackend(backends.Backend): o, s = self.generate_llvm_ir_compile(target, src) else: o, s = self.generate_single_compile(target, src, True, - order_deps=header_deps) + order_deps=header_deps) compiled_sources.append(s) source2object[s] = o obj_list.append(o) @@ -914,7 +914,7 @@ class NinjaBackend(backends.Backend): if cpp.get_id() != 'msvc': return False cppversion = self.environment.coredata.options[OptionKey('std', machine=target.for_machine, lang='cpp')].value - if cppversion not in ('latest', 'c++latest', 'vc++latest'): + if cppversion not in ('latest', 'c++latest', 'vc++latest'): return False if not mesonlib.current_vs_supports_modules(): return False @@ -1627,7 +1627,7 @@ class NinjaBackend(backends.Backend): for gen in target.get_generated_sources(): for ssrc in gen.get_outputs(): if isinstance(gen, GeneratedList): - ssrc = os.path.join(self.get_target_private_dir(target) , ssrc) + ssrc = os.path.join(self.get_target_private_dir(target), ssrc) else: ssrc = os.path.join(gen.get_subdir(), ssrc) if ssrc.endswith('.pyx'): @@ -2227,7 +2227,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) args = [x.replace('@DEPFILE@', depfile) for x in base_args] args = [x.replace("@INPUT@", infilename).replace('@OUTPUT@', sole_output) for x in args] - args = self.replace_outputs(args, self.get_target_private_dir(target), outfilelist) + args = self.replace_outputs(args, self.get_target_private_dir(target), outfilelist) # We have consumed output files, so drop them from the list of remaining outputs. if len(generator.outputs) > 1: outfilelist = outfilelist[len(generator.outputs):] @@ -2610,8 +2610,8 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) crstr = self.get_rule_suffix(target.for_machine) depelem = NinjaBuildElement(self.all_outputs, modfile, - 'FORTRAN_DEP_HACK' + crstr, - rel_obj) + 'FORTRAN_DEP_HACK' + crstr, + rel_obj) self.add_build(depelem) commands += compiler.get_module_outdir_args(self.get_target_private_dir(target)) diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index 3732570fd..ec7a01435 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -256,7 +256,7 @@ class XCodeBackend(backends.Backend): obj_path = f'{project}.build/{buildtype}/{tname}.build/Objects-normal/{arch}/{stem}.o' return obj_path - def get_extracted_obj_paths(self, target: build.BuildTarget, outputs: T.List[str])-> T.List[str]: + def get_extracted_obj_paths(self, target: build.BuildTarget, outputs: T.List[str]) -> T.List[str]: return outputs def generate(self): @@ -1269,7 +1269,7 @@ class XCodeBackend(backends.Backend): else: q.append(c) quoted_cmds.append(' '.join(q)) - cmdstr = '"' + ' && '.join(quoted_cmds) + '"' + cmdstr = '"' + ' && '.join(quoted_cmds) + '"' gen_dict.add_item('shellScript', cmdstr) gen_dict.add_item('showEnvVarsInLog', 0) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 37c2e0253..e2251ea47 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -636,7 +636,7 @@ class Target(HoldableObject): @staticmethod def parse_overrides(kwargs: T.Dict[str, T.Any]) -> T.Dict[OptionKey, str]: - opts = kwargs.get('override_options', []) + opts = kwargs.get('override_options', []) # In this case we have an already parsed and ready to go dictionary # provided by typed_kwargs @@ -907,10 +907,10 @@ class BuildTarget(Target): else: logger_fun = mlog.debug logger_fun(comp.get_display_language(), 'compiler for the', self.for_machine.get_lower_case_name(), 'machine:', - mlog.bold(' '.join(comp.get_exelist())), comp.get_version_string()) + mlog.bold(' '.join(comp.get_exelist())), comp.get_version_string()) if comp.linker is not None: logger_fun(comp.get_display_language(), 'linker for the', self.for_machine.get_lower_case_name(), 'machine:', - mlog.bold(' '.join(comp.linker.get_exelist())), comp.linker.id, comp.linker.version) + mlog.bold(' '.join(comp.linker.get_exelist())), comp.linker.id, comp.linker.version) if comp is None: raise MesonException(f'Cannot find required compiler {value}') self.compilers[value] = comp diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 0a8f814c5..a01938cb9 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -434,9 +434,9 @@ class VisualStudioCCompiler(MSVCCompiler, VisualStudioLikeCCompilerMixin, CCompi def get_options(self) -> 'KeyedOptionDictType': opts = super().get_options() c_stds = ['c89', 'c99'] - # Need to have these to be compatible with projects - # that set c_std to e.g. gnu99. - # https://github.com/mesonbuild/meson/issues/7611 + # Need to have these to be compatible with projects + # that set c_std to e.g. gnu99. + # https://github.com/mesonbuild/meson/issues/7611 g_stds = ['gnu89', 'gnu90', 'gnu9x', 'gnu99'] if version_compare(self.version, self._C11_VERSION): c_stds += ['c11'] diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 3eb9b90b5..e575b823a 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -76,8 +76,8 @@ class CPPCompiler(CLikeCompiler, Compiler): full_version: T.Optional[str] = None): # If a child ObjCPP class has already set it, don't set it ourselves Compiler.__init__(self, exelist, version, for_machine, info, - is_cross=is_cross, linker=linker, - full_version=full_version) + is_cross=is_cross, linker=linker, + full_version=full_version) CLikeCompiler.__init__(self, exe_wrapper) @staticmethod diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index 5a7df736a..1f396e4e1 100644 --- a/mesonbuild/compilers/cuda.py +++ b/mesonbuild/compilers/cuda.py @@ -171,7 +171,7 @@ class CudaCompiler(Compiler): '--qpp-config': '-qpp-config', # 4.2.8.19 } # Reverse map -short to --long options. - _FLAG_SHORT2LONG_WITHARGS = {v:k for k,v in _FLAG_LONG2SHORT_WITHARGS.items()} + _FLAG_SHORT2LONG_WITHARGS = {v: k for k, v in _FLAG_LONG2SHORT_WITHARGS.items()} def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, exe_wrapper: T.Optional['ExternalProgram'], @@ -186,7 +186,7 @@ class CudaCompiler(Compiler): self.warn_args = {level: self._to_host_flags(flags) for level, flags in host_compiler.warn_args.items()} @classmethod - def _shield_nvcc_list_arg(cls, arg: str, listmode: bool=True) -> str: + def _shield_nvcc_list_arg(cls, arg: str, listmode: bool = True) -> str: r""" Shield an argument against both splitting by NVCC's list-argument parse logic, and interpretation by any shell. @@ -390,11 +390,11 @@ class CudaCompiler(Compiler): val = next(flagit) # -o something except StopIteration: pass - elif flag.split('=',1)[0] in self._FLAG_LONG2SHORT_WITHARGS or \ - flag.split('=',1)[0] in self._FLAG_SHORT2LONG_WITHARGS: + elif flag.split('=', 1)[0] in self._FLAG_LONG2SHORT_WITHARGS or \ + flag.split('=', 1)[0] in self._FLAG_SHORT2LONG_WITHARGS: # This is either -o or a multi-letter flag, and it is receiving its # value after an = sign. - flag, val = flag.split('=',1) # -o=something + flag, val = flag.split('=', 1) # -o=something # Some dependencies (e.g., BoostDependency) add unspaced "-isystem/usr/include" arguments elif flag.startswith('-isystem'): val = flag[8:].strip() @@ -427,9 +427,9 @@ class CudaCompiler(Compiler): assert val is not None # Should only trip if there is a missing argument. # Take care of the various NVCC-supported flags that need special handling. - flag = self._FLAG_LONG2SHORT_WITHARGS.get(flag,flag) + flag = self._FLAG_LONG2SHORT_WITHARGS.get(flag, flag) - if flag in {'-include','-isystem','-I','-L','-l'}: + if flag in {'-include', '-isystem', '-I', '-L', '-l'}: # These flags are known to GCC, but list-valued in NVCC. They potentially # require double-quoting to prevent NVCC interpreting the flags as lists # when GCC would not have done so. diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py index 5e0710ba8..a25045d1e 100644 --- a/mesonbuild/compilers/detect.py +++ b/mesonbuild/compilers/detect.py @@ -211,7 +211,7 @@ def compiler_from_language(env: 'Environment', lang: str, for_machine: MachineCh } return lang_map[lang](env, for_machine) if lang in lang_map else None -def detect_compiler_for(env: 'Environment', lang: str, for_machine: MachineChoice)-> T.Optional[Compiler]: +def detect_compiler_for(env: 'Environment', lang: str, for_machine: MachineChoice) -> T.Optional[Compiler]: comp = compiler_from_language(env, lang, for_machine) if comp is not None: assert comp.for_machine == for_machine diff --git a/mesonbuild/compilers/mixins/c2000.py b/mesonbuild/compilers/mixins/c2000.py index 172d3d173..65261c6f1 100644 --- a/mesonbuild/compilers/mixins/c2000.py +++ b/mesonbuild/compilers/mixins/c2000.py @@ -124,6 +124,6 @@ class C2000Compiler(Compiler): parameter_list[idx] = i[:9] + os.path.normpath(os.path.join(build_dir, i[9:])) return parameter_list - + def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]: return ['--preproc_with_compile', f'--preproc_dependency={outfile}'] diff --git a/mesonbuild/compilers/mixins/clang.py b/mesonbuild/compilers/mixins/clang.py index b3ce7f1f5..94aa9a20f 100644 --- a/mesonbuild/compilers/mixins/clang.py +++ b/mesonbuild/compilers/mixins/clang.py @@ -125,7 +125,7 @@ class ClangCompiler(GnuLikeCompiler): # qcld: Qualcomm Snapdragon linker, based on LLVM if linker == 'qcld': - return ['-fuse-ld=qcld'] + return ['-fuse-ld=qcld'] if shutil.which(linker): if not shutil.which(linker): diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index 2242ca1fd..3d2df9b46 100644 --- a/mesonbuild/compilers/mixins/clike.py +++ b/mesonbuild/compilers/mixins/clike.py @@ -283,7 +283,7 @@ class CLikeCompiler(Compiler): return self.linker.import_library_args(implibname) def _sanity_check_impl(self, work_dir: str, environment: 'Environment', - sname: str, code: str) -> None: + sname: str, code: str) -> None: mlog.debug('Sanity testing ' + self.get_display_language() + ' compiler:', ' '.join(self.exelist)) mlog.debug(f'Is cross compiler: {self.is_cross!s}.') @@ -672,7 +672,7 @@ class CLikeCompiler(Compiler): #endif {delim}\n{dname}''' args = self.build_wrapper_args(env, extra_args, dependencies, - mode=CompileCheckMode.PREPROCESS).to_native() + mode=CompileCheckMode.PREPROCESS).to_native() func = functools.partial(self.cached_compile, code, env.coredata, extra_args=args, mode='preprocess') if disable_cache: func = functools.partial(self.compile, code, extra_args=args, mode='preprocess', temp_dir=env.scratch_dir) @@ -1096,7 +1096,7 @@ class CLikeCompiler(Compiler): return None def _find_library_impl(self, libname: str, env: 'Environment', extra_dirs: T.List[str], - code: str, libtype: LibType) -> T.Optional[T.List[str]]: + code: str, libtype: LibType) -> T.Optional[T.List[str]]: # These libraries are either built-in or invalid if libname in self.ignore_libs: return [] @@ -1158,7 +1158,7 @@ class CLikeCompiler(Compiler): return None def _find_framework_impl(self, name: str, env: 'Environment', extra_dirs: T.List[str], - allow_system: bool) -> T.Optional[T.List[str]]: + allow_system: bool) -> T.Optional[T.List[str]]: if isinstance(extra_dirs, str): extra_dirs = [extra_dirs] key = (tuple(self.exelist), name, tuple(extra_dirs), allow_system) diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py index 2e46e9d32..4bc721fdf 100644 --- a/mesonbuild/compilers/mixins/visualstudio.py +++ b/mesonbuild/compilers/mixins/visualstudio.py @@ -161,7 +161,7 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta): return ['/c'] def get_no_optimization_args(self) -> T.List[str]: - return ['/Od','/Oi-'] + return ['/Od', '/Oi-'] def sanitizer_compile_args(self, value: str) -> T.List[str]: if value == 'none': diff --git a/mesonbuild/compilers/objcpp.py b/mesonbuild/compilers/objcpp.py index e52068de8..7ee207736 100644 --- a/mesonbuild/compilers/objcpp.py +++ b/mesonbuild/compilers/objcpp.py @@ -59,7 +59,7 @@ class GnuObjCPPCompiler(GnuCompiler, ObjCPPCompiler): linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): ObjCPPCompiler.__init__(self, exelist, version, for_machine, is_cross, - info, exe_wrapper, linker=linker, full_version=full_version) + info, exe_wrapper, linker=linker, full_version=full_version) GnuCompiler.__init__(self, defines) default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'] self.warn_args = {'0': [], @@ -77,7 +77,7 @@ class ClangObjCPPCompiler(ClangCompiler, ObjCPPCompiler): linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): ObjCPPCompiler.__init__(self, exelist, version, for_machine, is_cross, - info, exe_wrapper, linker=linker, full_version=full_version) + info, exe_wrapper, linker=linker, full_version=full_version) ClangCompiler.__init__(self, defines) default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'] self.warn_args = {'0': [], diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 13d4704f0..7fe874120 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -673,7 +673,7 @@ class CoreData: self.deps.build.clear() def get_nondefault_buildtype_args(self): - result= [] + result = [] value = self.options[OptionKey('buildtype')].value if value == 'plain': opt = '0' diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py index 229e6f36d..0df868563 100644 --- a/mesonbuild/dependencies/dev.py +++ b/mesonbuild/dependencies/dev.py @@ -211,7 +211,7 @@ class LLVMDependencyConfigTool(ConfigToolDependency): # the C linker works fine if only using the C API. super().__init__(name, environment, kwargs, language='cpp') self.provided_modules: T.List[str] = [] - self.required_modules: mesonlib.OrderedSet[str] = mesonlib.OrderedSet() + self.required_modules: mesonlib.OrderedSet[str] = mesonlib.OrderedSet() self.module_details: T.List[str] = [] if not self.is_found: return diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 7c384f6d1..eaa018a7d 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -480,7 +480,7 @@ class IntlSystemDependency(SystemDependency): super().__init__(name, env, kwargs) h = self.clib_compiler.has_header('libintl.h', '', env) - self.link_args = self.clib_compiler.find_library('intl', env, [], self.libtype) + self.link_args = self.clib_compiler.find_library('intl', env, [], self.libtype) if h[0] and self.link_args: self.is_found = True diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index ff45375e8..f1dcaff38 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -619,7 +619,7 @@ class Interpreter(InterpreterBase, HoldableObject): @FeatureNewKwargs('declare_dependency', '0.54.0', ['variables']) @permittedKwargs({'include_directories', 'link_with', 'sources', 'dependencies', 'compile_args', 'link_args', 'link_whole', 'version', - 'variables' }) + 'variables'}) @noPosargs def func_declare_dependency(self, node, args, kwargs): version = kwargs.get('version', self.project_version) @@ -815,7 +815,7 @@ external dependencies (including libraries) must go to "dependencies".''') m = ['\nExecuting subproject', mlog.bold(stack)] if method != 'meson': m += ['method', mlog.bold(method)] - mlog.log(*m,'\n', nested=False) + mlog.log(*m, '\n', nested=False) try: if method == 'meson': @@ -1459,7 +1459,7 @@ external dependencies (including libraries) must go to "dependencies".''') def find_program_fallback(self, fallback, args, required, extra_info): mlog.log('Fallback to subproject', mlog.bold(fallback), 'which provides program', mlog.bold(' '.join(args))) - sp_kwargs = { 'required': required } + sp_kwargs = {'required': required} self.do_subproject(fallback, 'meson', sp_kwargs) return self.program_from_overrides(args, extra_info) diff --git a/mesonbuild/interpreter/primitives/array.py b/mesonbuild/interpreter/primitives/array.py index f2f458d42..fb42d0d99 100644 --- a/mesonbuild/interpreter/primitives/array.py +++ b/mesonbuild/interpreter/primitives/array.py @@ -34,7 +34,6 @@ class ArrayHolder(ObjectHolder[T.List[TYPE_var]], IterableObject): 'get': self.get_method, }) - self.trivial_operators.update({ MesonOperator.EQUALS: (list, lambda x: self.held_object == x), MesonOperator.NOT_EQUALS: (list, lambda x: self.held_object != x), diff --git a/mesonbuild/interpreter/primitives/integer.py b/mesonbuild/interpreter/primitives/integer.py index 9252c687f..6563ee9c7 100644 --- a/mesonbuild/interpreter/primitives/integer.py +++ b/mesonbuild/interpreter/primitives/integer.py @@ -80,4 +80,3 @@ class IntegerHolder(ObjectHolder[int]): if other == 0: raise InvalidArguments('Tried to divide by 0') return self.held_object % other - diff --git a/mesonbuild/interpreterbase/baseobjects.py b/mesonbuild/interpreterbase/baseobjects.py index 992ee141e..ca17481a1 100644 --- a/mesonbuild/interpreterbase/baseobjects.py +++ b/mesonbuild/interpreterbase/baseobjects.py @@ -42,6 +42,7 @@ TYPE_key_resolver = T.Callable[[mparser.BaseNode], str] if T.TYPE_CHECKING: from typing_extensions import Protocol __T = T.TypeVar('__T', bound=TYPE_var, contravariant=True) + class OperatorCall(Protocol[__T]): def __call__(self, other: __T) -> TYPE_var: ... diff --git a/mesonbuild/interpreterbase/decorators.py b/mesonbuild/interpreterbase/decorators.py index 5030b48ea..901c77aa4 100644 --- a/mesonbuild/interpreterbase/decorators.py +++ b/mesonbuild/interpreterbase/decorators.py @@ -267,7 +267,7 @@ def typed_pos_args(name: str, *types: T.Union[T.Type, T.Tuple[T.Type, ...]], nargs[i] = tuple(pos) elif optargs: if num_args < num_types + len(optargs): - diff = num_types + len(optargs) - num_args + diff = num_types + len(optargs) - num_args nargs[i] = tuple(list(args) + [None] * diff) else: nargs[i] = args @@ -297,7 +297,7 @@ class ContainerTypeInfo: """ def __init__(self, container: T.Type, contains: T.Union[T.Type, T.Tuple[T.Type, ...]], *, - pairs: bool = False, allow_empty: bool = True) : + pairs: bool = False, allow_empty: bool = True): self.container = container self.contains = contains self.pairs = pairs diff --git a/mesonbuild/linkers/detect.py b/mesonbuild/linkers/detect.py index f936e56ca..0bfd7083b 100644 --- a/mesonbuild/linkers/detect.py +++ b/mesonbuild/linkers/detect.py @@ -54,9 +54,9 @@ def __failed_to_detect_linker(compiler: T.List[str], args: T.List[str], stdout: def guess_win_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Type['Compiler'], - for_machine: MachineChoice, *, - use_linker_prefix: bool = True, invoked_directly: bool = True, - extra_args: T.Optional[T.List[str]] = None) -> 'DynamicLinker': + for_machine: MachineChoice, *, + use_linker_prefix: bool = True, invoked_directly: bool = True, + extra_args: T.Optional[T.List[str]] = None) -> 'DynamicLinker': env.coredata.add_lang_args(comp_class.language, comp_class, for_machine, env) # Explicitly pass logo here so that we can get the version of link.exe @@ -124,8 +124,8 @@ def guess_win_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Ty __failed_to_detect_linker(compiler, check_args, o, e) def guess_nix_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Type['Compiler'], - for_machine: MachineChoice, *, - extra_args: T.Optional[T.List[str]] = None) -> 'DynamicLinker': + for_machine: MachineChoice, *, + extra_args: T.Optional[T.List[str]] = None) -> 'DynamicLinker': """Helper for guessing what linker to use on Unix-Like OSes. :compiler: Invocation to use to get linker diff --git a/mesonbuild/linkers/linkers.py b/mesonbuild/linkers/linkers.py index e535ea04d..334fc4f24 100644 --- a/mesonbuild/linkers/linkers.py +++ b/mesonbuild/linkers/linkers.py @@ -1380,7 +1380,7 @@ class AIXDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker): if len(sys_path) == 0: # get_compiler_system_dirs doesn't support our compiler. # Use the default system library path - all_paths.update(['/usr/lib','/lib']) + all_paths.update(['/usr/lib', '/lib']) else: # Include the compiler's default library paths, but filter out paths that don't exist for p in sys_path: diff --git a/mesonbuild/mcompile.py b/mesonbuild/mcompile.py index c1b5a2ca3..536fccbac 100644 --- a/mesonbuild/mcompile.py +++ b/mesonbuild/mcompile.py @@ -38,7 +38,7 @@ def array_arg(value: str) -> T.List[str]: return UserArrayOption(None, value, allow_dups=True, user_input=True).value def validate_builddir(builddir: Path) -> None: - if not (builddir / 'meson-private' / 'coredata.dat' ).is_file(): + if not (builddir / 'meson-private' / 'coredata.dat').is_file(): raise MesonException(f'Current directory is not a meson build directory: `{builddir}`.\n' 'Please specify a valid build dir or change the working directory to it.\n' 'It is also possible that the build directory was generated with an old\n' @@ -110,8 +110,8 @@ def get_target_from_intro_data(target: ParsedTargetName, builddir: Path, introsp if (intro_target['subproject'] or (target.type and target.type != intro_target['type'].replace(' ', '_')) or (target.path - and intro_target['filename'] != 'no_name' - and Path(target.path) != Path(intro_target['filename'][0]).relative_to(resolved_bdir).parent)): + and intro_target['filename'] != 'no_name' + and Path(target.path) != Path(intro_target['filename'][0]).relative_to(resolved_bdir).parent)): continue found_targets += [intro_target] diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index cf7040f33..4fa2ec078 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -239,7 +239,7 @@ class Conf: dir_option_names = set(coredata.BUILTIN_DIR_OPTIONS) test_option_names = {OptionKey('errorlogs'), - OptionKey('stdsplit')} + OptionKey('stdsplit')} dir_options: 'coredata.KeyedOptionDictType' = {} test_options: 'coredata.KeyedOptionDictType' = {} diff --git a/mesonbuild/mesonlib/universal.py b/mesonbuild/mesonlib/universal.py index 3854f6365..3adc3943b 100644 --- a/mesonbuild/mesonlib/universal.py +++ b/mesonbuild/mesonlib/universal.py @@ -1132,7 +1132,7 @@ def do_replacement(regex: T.Pattern[str], line: str, variable_format: str, def do_define(regex: T.Pattern[str], line: str, confdata: 'ConfigurationData', variable_format: str) -> str: def get_cmake_define(line: str, confdata: 'ConfigurationData') -> str: arr = line.split() - define_value=[] + define_value = [] for token in arr[2:]: try: (v, desc) = confdata.get(token) @@ -1179,13 +1179,13 @@ def get_variable_regex(variable_format: str = 'meson') -> T.Pattern[str]: raise MesonException(f'Format "{variable_format}" not handled') return regex -def do_conf_str (src: str, data: list, confdata: 'ConfigurationData', variable_format: str, - encoding: str = 'utf-8') -> T.Tuple[T.List[str],T.Set[str], bool]: - def line_is_valid(line : str, variable_format: str) -> bool: +def do_conf_str(src: str, data: list, confdata: 'ConfigurationData', variable_format: str, + encoding: str = 'utf-8') -> T.Tuple[T.List[str], T.Set[str], bool]: + def line_is_valid(line: str, variable_format: str) -> bool: if variable_format == 'meson': if '#cmakedefine' in line: return False - else: #cmake format + else: # cmake format if '#mesondefine' in line: return False return True @@ -1206,7 +1206,7 @@ def do_conf_str (src: str, data: list, confdata: 'ConfigurationData', variable_f confdata_useless = False line = do_define(regex, line, confdata, variable_format) else: - if not line_is_valid(line,variable_format): + if not line_is_valid(line, variable_format): raise MesonException(f'Format error in {src}: saw "{line.strip()}" when format set to "{variable_format}"') line, missing = do_replacement(regex, line, variable_format, confdata) missing_variables.update(missing) diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py index 083780831..7d0da1309 100644 --- a/mesonbuild/minstall.py +++ b/mesonbuild/minstall.py @@ -238,7 +238,7 @@ def restore_selinux_contexts() -> None: return proc, out, err = Popen_safe(['restorecon', '-F', '-f-', '-0'], ('\0'.join(f for f in selinux_updates) + '\0')) - if proc.returncode != 0 : + if proc.returncode != 0: print('Failed to restore SELinux context of installed files...', 'Standard output:', out, 'Standard error:', err, sep='\n') @@ -719,7 +719,7 @@ class Installer: self.did_install_something = True try: self.fix_rpath(outname, t.rpath_dirs_to_remove, install_rpath, final_path, - install_name_mappings, verbose=False) + install_name_mappings, verbose=False) except SystemExit as e: if isinstance(e.code, int) and e.code == 0: pass diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py index 18cbc4818..6aee98422 100644 --- a/mesonbuild/mlog.py +++ b/mesonbuild/mlog.py @@ -256,7 +256,7 @@ def log(*args: TV_Loggable, is_error: bool = False, def _log(*args: TV_Loggable, is_error: bool = False, - **kwargs: T.Any) -> None: + **kwargs: T.Any) -> None: nested = kwargs.pop('nested', True) arr = process_markup(args, False) if log_file is not None: diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 94b9793ba..1c6952df7 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -162,7 +162,7 @@ class GnomeModule(ExtensionModule): if not found: prog = self._get_native_binary(state, 'gtk-update-icon-cache', 'gtk+-3.0', 'gtk_update_icon_cache') icondir = os.path.join(datadir_abs, 'icons', 'hicolor') - script = state.backend.get_executable_serialisation([prog, '-q', '-t' ,'-f', icondir]) + script = state.backend.get_executable_serialisation([prog, '-q', '-t', '-f', icondir]) script.skip_if_destdir = True rv.append(script) if kwargs['update_desktop_database'] and not self.install_update_desktop_database: @@ -184,7 +184,7 @@ class GnomeModule(ExtensionModule): glib_compile_resources = state.find_program('glib-compile-resources') cmd = [glib_compile_resources, '@INPUT@'] - source_dirs, dependencies = (mesonlib.extract_as_list(kwargs, c, pop=True) for c in ['source_dir', 'dependencies']) + source_dirs, dependencies = (mesonlib.extract_as_list(kwargs, c, pop=True) for c in ['source_dir', 'dependencies']) if len(args) < 2: raise MesonException('Not enough arguments; the name of the resource ' diff --git a/mesonbuild/modules/java.py b/mesonbuild/modules/java.py index 349ba76d3..0af5aec7d 100644 --- a/mesonbuild/modules/java.py +++ b/mesonbuild/modules/java.py @@ -38,7 +38,7 @@ class JavaModule(ExtensionModule): @typed_pos_args('generate_native_header', (str, FileHolder)) @typed_kwargs('java.generate_native_header', KwargInfo('package', str, default=None)) def generate_native_header(self, state: ModuleState, args: T.Tuple[T.Union[str, FileHolder]], - kwargs: T.Dict[str, T.Optional[str]]) -> ModuleReturnValue: + kwargs: T.Dict[str, T.Optional[str]]) -> ModuleReturnValue: assert state.backend package = kwargs.get('package') diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py index 001d3cafd..80d0c517c 100644 --- a/mesonbuild/modules/pkgconfig.py +++ b/mesonbuild/modules/pkgconfig.py @@ -554,8 +554,8 @@ class PkgConfigModule(ExtensionModule): if not isinstance(pkgroot, str): raise mesonlib.MesonException('Install_dir must be a string.') self._generate_pkgconfig_file(state, deps, subdirs, name, description, url, - version, pcfile, conflicts, variables, - unescaped_variables, False, dataonly) + version, pcfile, conflicts, variables, + unescaped_variables, False, dataonly) res = build.Data([mesonlib.File(True, state.environment.get_scratch_dir(), pcfile)], pkgroot, pkgroot_name, None, state.subproject, install_tag='devel') variables = self.interpreter.extract_variables(kwargs, argname='uninstalled_variables', dict_new=True) variables = parse_variable_list(variables) @@ -564,8 +564,8 @@ class PkgConfigModule(ExtensionModule): pcfile = filebase + '-uninstalled.pc' self._generate_pkgconfig_file(state, deps, subdirs, name, description, url, - version, pcfile, conflicts, variables, - unescaped_variables, uninstalled=True, dataonly=dataonly) + version, pcfile, conflicts, variables, + unescaped_variables, uninstalled=True, dataonly=dataonly) # Associate the main library with this generated pc file. If the library # is used in any subsequent call to the generated, it will generate a # 'Requires:' or 'Requires.private:'. diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index f479ab97c..28babeff2 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -338,7 +338,7 @@ if T.TYPE_CHECKING: link_libpython: bool paths: T.Dict[str, str] platform: str - suffix : str + suffix: str variables: T.Dict[str, str] version: str @@ -502,10 +502,10 @@ class PythonInstallation(ExternalProgramHolder): mlog.log('Dependency', mlog.bold('python'), 'skipped: feature', mlog.bold(feature), 'disabled') else: for d in python_factory(self.interpreter.environment, - MachineChoice.BUILD if kwargs.get('native', False) else MachineChoice.HOST, - kwargs, - process_method_kw({DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM}, kwargs), - self): + MachineChoice.BUILD if kwargs.get('native', False) else MachineChoice.HOST, + kwargs, + process_method_kw({DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM}, kwargs), + self): dep = d() if dep.found(): break diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py index 939dc21b5..269656250 100644 --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -173,7 +173,7 @@ class QtBaseModule(ExtensionModule): self._rcc_supports_depfiles = True else: mlog.warning('rcc dependencies will not work properly until you move to Qt >= 5.14:', - mlog.bold('https://bugreports.qt.io/browse/QTBUG-45460'), fatal=False) + mlog.bold('https://bugreports.qt.io/browse/QTBUG-45460'), fatal=False) else: suffix = f'-qt{self.qt_version}' self.tools['moc'] = NonExistingExternalProgram(name='moc' + suffix) diff --git a/mesonbuild/modules/unstable_external_project.py b/mesonbuild/modules/unstable_external_project.py index bfd3ea661..b8fd1b097 100644 --- a/mesonbuild/modules/unstable_external_project.py +++ b/mesonbuild/modules/unstable_external_project.py @@ -26,7 +26,7 @@ from ..interpreterbase import FeatureNew from ..interpreter.type_checking import ENV_KW from ..interpreterbase.decorators import ContainerTypeInfo, KwargInfo, typed_kwargs, typed_pos_args from ..mesonlib import (EnvironmentException, MesonException, Popen_safe, MachineChoice, - get_variable_regex, do_replacement, join_args, OptionKey) + get_variable_regex, do_replacement, join_args, OptionKey) if T.TYPE_CHECKING: from typing_extensions import TypedDict diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 8faf98955..606c89195 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -1676,10 +1676,10 @@ class TestHarness: runners.extend(self.get_test_runner(test) for test in tests) if i == 0: self.duration_max_len = max(len(str(int(runner.timeout or 99))) - for runner in runners) + for runner in runners) # Disable the progress report if it gets in the way self.need_console = any(runner.console_mode is not ConsoleUser.LOGGER - for runner in runners) + for runner in runners) self.test_count = len(runners) self.run_tests(runners) diff --git a/mesonbuild/scripts/clangtidy.py b/mesonbuild/scripts/clangtidy.py index d1732a317..9f489427a 100644 --- a/mesonbuild/scripts/clangtidy.py +++ b/mesonbuild/scripts/clangtidy.py @@ -46,7 +46,7 @@ def clangtidy(srcdir_name: str, builddir_name: str) -> int: run_clang_tidy = rct break if run_clang_tidy: - return subprocess.run([run_clang_tidy, '-p', builddir_name, '^(?!' + re.escape(builddir_name + os.path.sep) +').*$']).returncode + return subprocess.run([run_clang_tidy, '-p', builddir_name, '^(?!' + re.escape(builddir_name + os.path.sep) + ').*$']).returncode else: print('Could not find run-clang-tidy, running checks manually.') return manual_clangtidy(srcdir_name, builddir_name) diff --git a/mesonbuild/scripts/depscan.py b/mesonbuild/scripts/depscan.py index 7f28f1ddf..3b26f92b5 100644 --- a/mesonbuild/scripts/depscan.py +++ b/mesonbuild/scripts/depscan.py @@ -184,7 +184,7 @@ class DependencyScanner: else: mod_gen = '' if quoted_module_files_needed: - mod_dep = '| ' + ' '.join(quoted_module_files_needed) + mod_dep = '| ' + ' '.join(quoted_module_files_needed) else: mod_dep = '' build_line = 'build {} {}: dyndep {}'.format(quoted_objfilename, diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 1db2cfaee..08da31922 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -33,7 +33,7 @@ from . import WrapMode from .. import coredata from ..mesonlib import quiet_git, GIT, ProgressBar, MesonException from ..interpreterbase import FeatureNew -from .. import mesonlib +from .. import mesonlib if T.TYPE_CHECKING: import http.client @@ -151,7 +151,6 @@ class PackageDefinition: if f'{what}_filename' in self.values and f'{what}_url' not in self.values: FeatureNew(f'Local wrap patch files without {what}_url', '0.55.0').use(self.subproject) - def parse_wrap_section(self, config: configparser.ConfigParser) -> None: if len(config.sections()) < 1: raise WrapException(f'Missing sections in {self.basename}')