flake8: fix various whitespace errors with badly aligned code

pull/10011/head
Eli Schwartz 3 years ago
parent 0d6972887f
commit 9daaece785
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 2
      mesonbuild/backend/backends.py
  2. 16
      mesonbuild/build.py
  3. 2
      mesonbuild/compilers/compilers.py
  4. 3
      mesonbuild/compilers/detect.py
  5. 2
      mesonbuild/compilers/mixins/clang.py
  6. 11
      mesonbuild/compilers/mixins/pgi.py
  7. 4
      mesonbuild/interpreter/type_checking.py
  8. 15
      mesonbuild/modules/gnome.py

@ -1386,7 +1386,7 @@ class Backend:
def eval_custom_target_command( def eval_custom_target_command(
self, target: build.CustomTarget, absolute_outputs: bool = False) -> \ self, target: build.CustomTarget, absolute_outputs: bool = False) -> \
T.Tuple[T.List[str], T.List[str], T.List[str]]: T.Tuple[T.List[str], T.List[str], T.List[str]]:
# We want the outputs to be absolute only when using the VS backend # We want the outputs to be absolute only when using the VS backend
# XXX: Maybe allow the vs backend to use relative paths too? # XXX: Maybe allow the vs backend to use relative paths too?
source_root = self.build_to_src source_root = self.build_to_src

@ -1345,8 +1345,8 @@ You probably should put it in link_with instead.''')
if isinstance(t, (CustomTarget, CustomTargetIndex)): if isinstance(t, (CustomTarget, CustomTargetIndex)):
if not t.should_install(): if not t.should_install():
mlog.warning(f'Try to link an installed static library target {self.name} with a' mlog.warning(f'Try to link an installed static library target {self.name} with a'
'custom target that is not installed, this might cause problems' 'custom target that is not installed, this might cause problems'
'when you try to use this static library') 'when you try to use this static library')
elif t.is_internal(): elif t.is_internal():
# When we're a static library and we link_with to an # When we're a static library and we link_with to an
# internal/convenience library, promote to link_whole. # internal/convenience library, promote to link_whole.
@ -1600,12 +1600,12 @@ You probably should put it in link_with instead.''')
link_target.force_soname = True link_target.force_soname = True
else: else:
mlog.deprecation(f'target {self.name} links against shared module {link_target.name}, which is incorrect.' mlog.deprecation(f'target {self.name} links against shared module {link_target.name}, which is incorrect.'
'\n ' '\n '
f'This will be an error in the future, so please use shared_library() for {link_target.name} instead.' f'This will be an error in the future, so please use shared_library() for {link_target.name} instead.'
'\n ' '\n '
f'If shared_module() was used for {link_target.name} because it has references to undefined symbols,' f'If shared_module() was used for {link_target.name} because it has references to undefined symbols,'
'\n ' '\n '
'use shared_libary() with `override_options: [\'b_lundef=false\']` instead.') 'use shared_libary() with `override_options: [\'b_lundef=false\']` instead.')
link_target.force_soname = True link_target.force_soname = True
class Generator(HoldableObject): class Generator(HoldableObject):

@ -1224,7 +1224,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
yield r yield r
def compiles(self, code: 'mesonlib.FileOrString', env: 'Environment', *, def compiles(self, code: 'mesonlib.FileOrString', env: 'Environment', *,
extra_args: T.Union[None, T.List[str], CompilerArgs, T.Callable[[CompileCheckMode], T.List[str]]] = None, extra_args: T.Union[None, T.List[str], CompilerArgs, T.Callable[[CompileCheckMode], T.List[str]]] = None,
dependencies: T.Optional[T.List['Dependency']] = None, dependencies: T.Optional[T.List['Dependency']] = None,
mode: str = 'compile', mode: str = 'compile',
disable_cache: bool = False) -> T.Tuple[bool, bool]: disable_cache: bool = False) -> T.Tuple[bool, bool]:

@ -255,8 +255,7 @@ def _get_compilers(env: 'Environment', lang: str, for_machine: MachineChoice) ->
def _handle_exceptions( def _handle_exceptions(
exceptions: T.Mapping[str, T.Union[Exception, str]], exceptions: T.Mapping[str, T.Union[Exception, str]],
binaries: T.List[T.List[str]], binaries: T.List[T.List[str]],
bintype: str = 'compiler' bintype: str = 'compiler') -> T.NoReturn:
) -> T.NoReturn:
errmsg = f'Unknown {bintype}(s): {binaries}' errmsg = f'Unknown {bintype}(s): {binaries}'
if exceptions: if exceptions:
errmsg += '\nThe following exception(s) were encountered:' errmsg += '\nThe following exception(s) were encountered:'

@ -106,7 +106,7 @@ class ClangCompiler(GnuLikeCompiler):
if isinstance(self.linker, AppleDynamicLinker) and mesonlib.version_compare(self.version, '>=8.0'): if isinstance(self.linker, AppleDynamicLinker) and mesonlib.version_compare(self.version, '>=8.0'):
extra_args.append('-Wl,-no_weak_imports') extra_args.append('-Wl,-no_weak_imports')
return super().has_function(funcname, prefix, env, extra_args=extra_args, return super().has_function(funcname, prefix, env, extra_args=extra_args,
dependencies=dependencies) dependencies=dependencies)
def openmp_flags(self) -> T.List[str]: def openmp_flags(self) -> T.List[str]:
if mesonlib.version_compare(self.version, '>=3.8.0'): if mesonlib.version_compare(self.version, '>=3.8.0'):

@ -49,11 +49,12 @@ class PGICompiler(Compiler):
self.base_options = {OptionKey('b_pch')} self.base_options = {OptionKey('b_pch')}
default_warn_args = ['-Minform=inform'] default_warn_args = ['-Minform=inform']
self.warn_args = {'0': [], self.warn_args: T.Dict[str, T.List[str]] = {
'1': default_warn_args, '0': [],
'2': default_warn_args, '1': default_warn_args,
'3': default_warn_args '2': default_warn_args,
} # type: T.Dict[str, T.List[str]] '3': default_warn_args
}
def get_module_incdir_args(self) -> T.Tuple[str]: def get_module_incdir_args(self) -> T.Tuple[str]:
return ('-module', ) return ('-module', )

@ -287,8 +287,8 @@ CT_BUILD_BY_DEFAULT: KwargInfo[T.Optional[bool]] = KwargInfo('build_by_default',
CT_BUILD_ALWAYS: KwargInfo[T.Optional[bool]] = KwargInfo( CT_BUILD_ALWAYS: KwargInfo[T.Optional[bool]] = KwargInfo(
'build_always', (bool, NoneType), 'build_always', (bool, NoneType),
deprecated='0.47.0', deprecated='0.47.0',
deprecated_message='combine build_by_default and build_always_stale instead.', deprecated_message='combine build_by_default and build_always_stale instead.',
) )
CT_BUILD_ALWAYS_STALE: KwargInfo[T.Optional[bool]] = KwargInfo( CT_BUILD_ALWAYS_STALE: KwargInfo[T.Optional[bool]] = KwargInfo(

@ -339,7 +339,8 @@ class GnomeModule(ExtensionModule):
# Normal program lookup # Normal program lookup
return state.find_program(name, required=required) return state.find_program(name, required=required)
@typed_kwargs('gnome.post_install', @typed_kwargs(
'gnome.post_install',
KwargInfo('glib_compile_schemas', bool, default=False), KwargInfo('glib_compile_schemas', bool, default=False),
KwargInfo('gio_querymodules', ContainerTypeInfo(list, str), default=[], listify=True), KwargInfo('gio_querymodules', ContainerTypeInfo(list, str), default=[], listify=True),
KwargInfo('gtk_update_icon_cache', bool, default=False), KwargInfo('gtk_update_icon_cache', bool, default=False),
@ -899,7 +900,7 @@ class GnomeModule(ExtensionModule):
libsources: T.Sequence[T.Union[ libsources: T.Sequence[T.Union[
str, mesonlib.File, build.GeneratedList, str, mesonlib.File, build.GeneratedList,
build.CustomTarget, build.CustomTargetIndex]] build.CustomTarget, build.CustomTargetIndex]]
) -> str: ) -> str:
gir_filelist_dir = state.backend.get_target_private_dir_abs(girtargets[0]) gir_filelist_dir = state.backend.get_target_private_dir_abs(girtargets[0])
if not os.path.isdir(gir_filelist_dir): if not os.path.isdir(gir_filelist_dir):
os.mkdir(gir_filelist_dir) os.mkdir(gir_filelist_dir)
@ -1061,12 +1062,12 @@ class GnomeModule(ExtensionModule):
KwargInfo('includes', ContainerTypeInfo(list, (str, GirTarget)), default=[], listify=True), KwargInfo('includes', ContainerTypeInfo(list, (str, GirTarget)), default=[], listify=True),
KwargInfo('install_gir', (bool, NoneType), since='0.61.0'), KwargInfo('install_gir', (bool, NoneType), since='0.61.0'),
KwargInfo('install_dir_gir', (str, bool, NoneType), KwargInfo('install_dir_gir', (str, bool, NoneType),
deprecated_values={False: ('0.61.0', 'Use install_gir to disable installation')}, deprecated_values={False: ('0.61.0', 'Use install_gir to disable installation')},
validator=lambda x: 'as boolean can only be false' if x is True else None), validator=lambda x: 'as boolean can only be false' if x is True else None),
KwargInfo('install_typelib', (bool, NoneType), since='0.61.0'), KwargInfo('install_typelib', (bool, NoneType), since='0.61.0'),
KwargInfo('install_dir_typelib', (str, bool, NoneType), KwargInfo('install_dir_typelib', (str, bool, NoneType),
deprecated_values={False: ('0.61.0', 'Use install_typelib to disable installation')}, deprecated_values={False: ('0.61.0', 'Use install_typelib to disable installation')},
validator=lambda x: 'as boolean can only be false' if x is True else None), validator=lambda x: 'as boolean can only be false' if x is True else None),
KwargInfo('link_with', ContainerTypeInfo(list, (build.SharedLibrary, build.StaticLibrary)), default=[], listify=True), KwargInfo('link_with', ContainerTypeInfo(list, (build.SharedLibrary, build.StaticLibrary)), default=[], listify=True),
KwargInfo('namespace', str, required=True), KwargInfo('namespace', str, required=True),
KwargInfo('nsversion', str, required=True), KwargInfo('nsversion', str, required=True),
@ -1360,7 +1361,7 @@ class GnomeModule(ExtensionModule):
KwargInfo('mkdb_args', ContainerTypeInfo(list, str), default=[], listify=True), KwargInfo('mkdb_args', ContainerTypeInfo(list, str), default=[], listify=True),
KwargInfo( KwargInfo(
'mode', str, default='auto', since='0.37.0', 'mode', str, default='auto', since='0.37.0',
validator=in_set_validator({'xml', 'sgml', 'none', 'auto'})), validator=in_set_validator({'xml', 'sgml', 'none', 'auto'})),
KwargInfo('module_version', str, default='', since='0.48.0'), KwargInfo('module_version', str, default='', since='0.48.0'),
KwargInfo('namespace', str, default='', since='0.37.0'), KwargInfo('namespace', str, default='', since='0.37.0'),
KwargInfo('scan_args', ContainerTypeInfo(list, str), default=[], listify=True), KwargInfo('scan_args', ContainerTypeInfo(list, str), default=[], listify=True),

Loading…
Cancel
Save