flake8: fix indentation style

pull/9893/head
Eli Schwartz 3 years ago committed by Dylan Baker
parent a28d546795
commit 3990dc6d64
  1. 46
      mesonbuild/compilers/detect.py
  2. 2
      mesonbuild/dependencies/hdf5.py
  3. 2
      mesonbuild/dependencies/pkgconfig.py
  4. 6
      mesonbuild/interpreter/compiler.py
  5. 6
      mesonbuild/interpreter/interpreter.py
  6. 2
      mesonbuild/interpreterbase/interpreterbase.py
  7. 4
      mesonbuild/modules/i18n.py
  8. 6
      mesonbuild/templates/valatemplates.py

@ -381,9 +381,9 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
return os.path.normcase(os.path.abspath(p))
watcom_cls = [sanitize(os.path.join(os.environ['WATCOM'], 'BINNT', 'cl')),
sanitize(os.path.join(os.environ['WATCOM'], 'BINNT', 'cl.exe')),
sanitize(os.path.join(os.environ['WATCOM'], 'BINNT64', 'cl')),
sanitize(os.path.join(os.environ['WATCOM'], 'BINNT64', 'cl.exe')),]
sanitize(os.path.join(os.environ['WATCOM'], 'BINNT', 'cl.exe')),
sanitize(os.path.join(os.environ['WATCOM'], 'BINNT64', 'cl')),
sanitize(os.path.join(os.environ['WATCOM'], 'BINNT64', 'cl.exe')),]
found_cl = sanitize(shutil.which('cl'))
if found_cl in watcom_cls:
mlog.debug('Skipping unsupported cl.exe clone at:', found_cl)
@ -779,7 +779,7 @@ def detect_fortran_compiler(env: 'Environment', for_machine: MachineChoice) -> C
cls = PGIFortranCompiler
env.coredata.add_lang_args(cls.language, cls, for_machine, env)
linker = PGIDynamicLinker(compiler, for_machine,
cls.LINKER_PREFIX, [], version=version)
cls.LINKER_PREFIX, [], version=version)
return cls(
compiler, version, for_machine, is_cross, info, exe_wrap,
full_version=full_version, linker=linker)
@ -788,21 +788,21 @@ def detect_fortran_compiler(env: 'Environment', for_machine: MachineChoice) -> C
cls = NvidiaHPC_FortranCompiler
env.coredata.add_lang_args(cls.language, cls, for_machine, env)
linker = PGIDynamicLinker(compiler, for_machine,
cls.LINKER_PREFIX, [], version=version)
cls.LINKER_PREFIX, [], version=version)
return cls(
compiler, version, for_machine, is_cross, info, exe_wrap,
full_version=full_version, linker=linker)
if 'flang' in out or 'clang' in out:
linker = guess_nix_linker(env,
compiler, FlangFortranCompiler, for_machine)
compiler, FlangFortranCompiler, for_machine)
return FlangFortranCompiler(
compiler, version, for_machine, is_cross, info,
exe_wrap, full_version=full_version, linker=linker)
if 'Open64 Compiler Suite' in err:
linker = guess_nix_linker(env,
compiler, Open64FortranCompiler, for_machine)
compiler, Open64FortranCompiler, for_machine)
return Open64FortranCompiler(
compiler, version, for_machine, is_cross, info,
exe_wrap, full_version=full_version, linker=linker)
@ -1036,14 +1036,14 @@ def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> Rust
# TODO rewrite this without type: ignore
if is_link_exe:
linker = type(cc.linker)(for_machine, always_args, exelist=cc.linker.exelist, # type: ignore
version=cc.linker.version, **extra_args) # type: ignore
version=cc.linker.version, **extra_args) # type: ignore
else:
linker = type(cc.linker)(compiler, for_machine, cc.LINKER_PREFIX,
always_args=always_args, version=cc.linker.version,
**extra_args) # type: ignore
always_args=always_args, version=cc.linker.version,
**extra_args) # type: ignore
elif 'link' in override[0]:
linker = guess_win_linker(env,
override, cls, for_machine, use_linker_prefix=False)
override, cls, for_machine, use_linker_prefix=False)
# rustc takes linker arguments without a prefix, and
# inserts the correct prefix itself.
assert isinstance(linker, VisualStudioLikeLinkerMixin)
@ -1118,17 +1118,17 @@ def detect_d_compiler(env: 'Environment', for_machine: MachineChoice) -> Compile
if info.is_windows() or info.is_cygwin():
objfile = os.path.basename(f)[:-1] + 'obj'
linker = guess_win_linker(env,
exelist,
LLVMDCompiler, for_machine,
use_linker_prefix=True, invoked_directly=False,
extra_args=[f])
exelist,
LLVMDCompiler, for_machine,
use_linker_prefix=True, invoked_directly=False,
extra_args=[f])
else:
# LDC writes an object file to the current working directory.
# Clean it up.
objfile = os.path.basename(f)[:-1] + 'o'
linker = guess_nix_linker(env,
exelist, LLVMDCompiler, for_machine,
extra_args=[f])
exelist, LLVMDCompiler, for_machine,
extra_args=[f])
finally:
windows_proof_rm(f)
windows_proof_rm(objfile)
@ -1157,13 +1157,13 @@ def detect_d_compiler(env: 'Environment', for_machine: MachineChoice) -> Compile
if info.is_windows() or info.is_cygwin():
objfile = os.path.basename(f)[:-1] + 'obj'
linker = guess_win_linker(env,
exelist, DmdDCompiler, for_machine,
invoked_directly=False, extra_args=[f, arch_arg])
exelist, DmdDCompiler, for_machine,
invoked_directly=False, extra_args=[f, arch_arg])
else:
objfile = os.path.basename(f)[:-1] + 'o'
linker = guess_nix_linker(env,
exelist, DmdDCompiler, for_machine,
extra_args=[f, arch_arg])
exelist, DmdDCompiler, for_machine,
extra_args=[f, arch_arg])
finally:
windows_proof_rm(f)
windows_proof_rm(objfile)
@ -1193,8 +1193,8 @@ def detect_swift_compiler(env: 'Environment', for_machine: MachineChoice) -> Com
# As for 5.0.1 swiftc *requires* a file to check the linker:
with tempfile.NamedTemporaryFile(suffix='.swift') as f:
linker = guess_nix_linker(env,
exelist, SwiftCompiler, for_machine,
extra_args=[f.name])
exelist, SwiftCompiler, for_machine,
extra_args=[f.name])
return SwiftCompiler(
exelist, version, for_machine, is_cross, info, linker=linker)

@ -164,7 +164,7 @@ def hdf5_factory(env: 'Environment', for_machine: 'MachineChoice',
if PCEXE:
# some distros put hdf5-1.2.3.pc with version number in .pc filename.
ret = subprocess.run([PCEXE, '--list-all'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
text=True)
text=True)
if ret.returncode == 0:
for pkg in ret.stdout.split('\n'):
if pkg.startswith('hdf5'):

@ -296,7 +296,7 @@ class PkgConfigDependency(ExternalDependency):
continue
else:
mlog.warning('Library {!r} not found for dependency {!r}, may '
'not be successfully linked'.format(libfilename, self.name))
'not be successfully linked'.format(libfilename, self.name))
libs_notfound.append(lib)
else:
lib = foundname

@ -222,9 +222,9 @@ class CompilerHolder(ObjectHolder['Compiler']):
return self.compiler.exelist
def _determine_args(self, nobuiltins: bool,
incdirs: T.List[build.IncludeDirs],
extra_args: T.List[str],
mode: CompileCheckMode = CompileCheckMode.LINK) -> T.List[str]:
incdirs: T.List[build.IncludeDirs],
extra_args: T.List[str],
mode: CompileCheckMode = CompileCheckMode.LINK) -> T.List[str]:
args: T.List[str] = []
for i in incdirs:
for idir in i.to_string_list(self.environment.get_source_dir()):

@ -701,14 +701,14 @@ external dependencies (including libraries) must go to "dependencies".''')
)
def func_run_command(self, node: mparser.BaseNode,
args: T.Tuple[T.Union[build.Executable, ExternalProgram, compilers.Compiler, mesonlib.File, str],
T.List[T.Union[build.Executable, ExternalProgram, compilers.Compiler, mesonlib.File, str]]],
T.List[T.Union[build.Executable, ExternalProgram, compilers.Compiler, mesonlib.File, str]]],
kwargs: 'kwargs.RunCommand') -> RunProcess:
return self.run_command_impl(node, args, kwargs)
def run_command_impl(self,
node: mparser.BaseNode,
args: T.Tuple[T.Union[build.Executable, ExternalProgram, compilers.Compiler, mesonlib.File, str],
T.List[T.Union[build.Executable, ExternalProgram, compilers.Compiler, mesonlib.File, str]]],
T.List[T.Union[build.Executable, ExternalProgram, compilers.Compiler, mesonlib.File, str]]],
kwargs: 'kwargs.RunCommand',
in_builddir: bool = False) -> RunProcess:
cmd, cargs = args
@ -2286,7 +2286,7 @@ external dependencies (including libraries) must go to "dependencies".''')
cmd, *args = mesonlib.listify(_cmd)
res = self.run_command_impl(node, (cmd, args),
{'capture': True, 'check': True, 'env': build.EnvironmentVariables()},
True)
True)
if 'capture' in kwargs and kwargs['capture']:
dst_tmp = ofile_abs + '~'
file_encoding = kwargs.setdefault('encoding', 'utf-8')

@ -376,7 +376,7 @@ class InterpreterBase:
val = _unholder(self.variables[var])
if not isinstance(val, (str, int, float, bool)):
raise InvalidCode(f'Identifier "{var}" does not name a formattable variable ' +
'(has to be an integer, a string, a floating point number or a boolean).')
'(has to be an integer, a string, a floating point number or a boolean).')
return str(val)
except KeyError:

@ -199,7 +199,7 @@ class I18nModule(ExtensionModule):
}
ct = build.CustomTarget('', state.subdir, state.subproject,
T.cast(T.Dict[str, T.Any], real_kwargs))
T.cast(T.Dict[str, T.Any], real_kwargs))
return ModuleReturnValue(ct, [ct])
@ -343,7 +343,7 @@ class I18nModule(ExtensionModule):
}
ct = build.CustomTarget('', state.subdir, state.subproject,
T.cast(T.Dict[str, T.Any], real_kwargs))
T.cast(T.Dict[str, T.Any], real_kwargs))
return ModuleReturnValue(ct, [ct])

@ -93,9 +93,9 @@ class ValaProject(SampleImpl):
open(source_name, 'w', encoding='utf-8').write(hello_vala_template.format(project_name=self.name))
open('meson.build', 'w', encoding='utf-8').write(
hello_vala_meson_template.format(project_name=self.name,
exe_name=lowercase_token,
source_name=source_name,
version=self.version))
exe_name=lowercase_token,
source_name=source_name,
version=self.version))
def create_library(self) -> None:
lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())

Loading…
Cancel
Save