fix various flake8 whitespace errors

pull/9667/head
Eli Schwartz 3 years ago committed by Nirbheek Chauhan
parent 18abf2cebb
commit 5f5ebc7262
  1. 2
      mesonbuild/_typing.py
  2. 12
      mesonbuild/backend/ninjabackend.py
  3. 4
      mesonbuild/backend/xcodebackend.py
  4. 6
      mesonbuild/build.py
  5. 6
      mesonbuild/compilers/c.py
  6. 4
      mesonbuild/compilers/cpp.py
  7. 14
      mesonbuild/compilers/cuda.py
  8. 2
      mesonbuild/compilers/detect.py
  9. 2
      mesonbuild/compilers/mixins/clang.py
  10. 8
      mesonbuild/compilers/mixins/clike.py
  11. 2
      mesonbuild/compilers/mixins/visualstudio.py
  12. 4
      mesonbuild/compilers/objcpp.py
  13. 2
      mesonbuild/coredata.py
  14. 2
      mesonbuild/dependencies/dev.py
  15. 2
      mesonbuild/dependencies/misc.py
  16. 6
      mesonbuild/interpreter/interpreter.py
  17. 1
      mesonbuild/interpreter/primitives/array.py
  18. 1
      mesonbuild/interpreter/primitives/integer.py
  19. 1
      mesonbuild/interpreterbase/baseobjects.py
  20. 4
      mesonbuild/interpreterbase/decorators.py
  21. 10
      mesonbuild/linkers/detect.py
  22. 2
      mesonbuild/linkers/linkers.py
  23. 6
      mesonbuild/mcompile.py
  24. 2
      mesonbuild/mconf.py
  25. 12
      mesonbuild/mesonlib/universal.py
  26. 4
      mesonbuild/minstall.py
  27. 2
      mesonbuild/mlog.py
  28. 4
      mesonbuild/modules/gnome.py
  29. 2
      mesonbuild/modules/java.py
  30. 8
      mesonbuild/modules/pkgconfig.py
  31. 10
      mesonbuild/modules/python.py
  32. 2
      mesonbuild/modules/qt.py
  33. 2
      mesonbuild/modules/unstable_external_project.py
  34. 4
      mesonbuild/mtest.py
  35. 2
      mesonbuild/scripts/clangtidy.py
  36. 2
      mesonbuild/scripts/depscan.py
  37. 3
      mesonbuild/wrap/wrap.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]: ...

@ -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))

@ -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)

@ -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

@ -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']

@ -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

@ -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.

@ -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

@ -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):

@ -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)

@ -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':

@ -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': [],

@ -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'

@ -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

@ -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

@ -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)

@ -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),

@ -80,4 +80,3 @@ class IntegerHolder(ObjectHolder[int]):
if other == 0:
raise InvalidArguments('Tried to divide by 0')
return self.held_object % other

@ -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: ...

@ -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

@ -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

@ -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:

@ -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]

@ -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' = {}

@ -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)

@ -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

@ -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:

@ -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 '

@ -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')

@ -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:'.

@ -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

@ -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)

@ -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

@ -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)

@ -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)

@ -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,

@ -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}')

Loading…
Cancel
Save