aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2024-05-19 14:43:05 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2024-05-19 14:43:05 +0300
commit09bdb003d7864230b1870c35727fe90c5f69a9fd (patch)
treecb1dd2f6c2ed66735dded081fe1e4d2984381ab7
parent7d28ff29396f9d7043204de8ddc52226b9903811 (diff)
downloadmeson-lintfixes.zip
meson-lintfixes.tar.gz
meson-lintfixes.tar.bz2
Fix new linter warnings.lintfixes
-rw-r--r--mesonbuild/ast/introspection.py2
-rw-r--r--mesonbuild/compilers/detect.py4
-rw-r--r--mesonbuild/dependencies/dub.py5
-rw-r--r--mesonbuild/dependencies/misc.py1
-rw-r--r--mesonbuild/dependencies/mpi.py1
-rw-r--r--mesonbuild/dependencies/pkgconfig.py3
-rw-r--r--mesonbuild/linkers/detect.py2
-rw-r--r--mesonbuild/mintro.py2
-rw-r--r--mesonbuild/mlog.py2
-rw-r--r--mesonbuild/modules/dlang.py1
-rw-r--r--mesonbuild/modules/gnome.py2
-rw-r--r--mesonbuild/modules/pkgconfig.py3
-rw-r--r--mesonbuild/scripts/clangformat.py1
-rw-r--r--mesonbuild/scripts/coverage.py1
14 files changed, 22 insertions, 8 deletions
diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py
index 5bf7e05..fa11feb 100644
--- a/mesonbuild/ast/introspection.py
+++ b/mesonbuild/ast/introspection.py
@@ -145,7 +145,7 @@ class IntrospectionInterpreter(AstInterpreter):
subi.project_data['name'] = dirname
self.project_data['subprojects'] += [subi.project_data]
except (mesonlib.MesonException, RuntimeError):
- return
+ pass
def func_add_languages(self, node: BaseNode, args: T.List[TYPE_var], kwargs: T.Dict[str, TYPE_var]) -> None:
kwargs = self.flatten_kwargs(kwargs)
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
index 90a3ac5..e6b2d4d 100644
--- a/mesonbuild/compilers/detect.py
+++ b/mesonbuild/compilers/detect.py
@@ -1139,6 +1139,7 @@ def detect_d_compiler(env: 'Environment', for_machine: MachineChoice) -> Compile
# one path for simplicity.
o, f = tempfile.mkstemp('.d')
os.close(o)
+ objfile = None
try:
if info.is_windows() or info.is_cygwin():
@@ -1157,7 +1158,8 @@ def detect_d_compiler(env: 'Environment', for_machine: MachineChoice) -> Compile
extra_args=[f])
finally:
windows_proof_rm(f)
- windows_proof_rm(objfile)
+ if objfile is not None:
+ windows_proof_rm(objfile)
return cls(
exelist, version, for_machine, info, arch,
diff --git a/mesonbuild/dependencies/dub.py b/mesonbuild/dependencies/dub.py
index e4f09d4..a74fd47 100644
--- a/mesonbuild/dependencies/dub.py
+++ b/mesonbuild/dependencies/dub.py
@@ -262,9 +262,8 @@ class DubDependency(ExternalDependency):
self.link_args.append(flag)
is_windows = self.env.machines.host.is_windows()
- if is_windows:
- winlibs = ['kernel32', 'user32', 'gdi32', 'winspool', 'shell32', 'ole32',
- 'oleaut32', 'uuid', 'comdlg32', 'advapi32', 'ws2_32']
+ winlibs = ['kernel32', 'user32', 'gdi32', 'winspool', 'shell32', 'ole32',
+ 'oleaut32', 'uuid', 'comdlg32', 'advapi32', 'ws2_32'] if is_windows else []
for lib in bs['libs']:
if os.name != 'nt':
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index fd59652..72c7cf0 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -422,7 +422,6 @@ class IntlSystemDependency(SystemDependency):
if self.static:
if not self._add_sub_dependency(iconv_factory(env, self.for_machine, {'static': True})):
self.is_found = False
- return
class OpensslSystemDependency(SystemDependency):
diff --git a/mesonbuild/dependencies/mpi.py b/mesonbuild/dependencies/mpi.py
index f9c911c..50ff4db 100644
--- a/mesonbuild/dependencies/mpi.py
+++ b/mesonbuild/dependencies/mpi.py
@@ -213,6 +213,7 @@ class MSMPIDependency(SystemDependency):
incdir = os.environ.get('MSMPI_INC')
arch = detect_cpu_family(self.env.coredata.compilers.host)
libdir = None
+ post = None
if arch == 'x86':
libdir = os.environ.get('MSMPI_LIB32')
post = 'x86'
diff --git a/mesonbuild/dependencies/pkgconfig.py b/mesonbuild/dependencies/pkgconfig.py
index 30e3d28..0dabc6a 100644
--- a/mesonbuild/dependencies/pkgconfig.py
+++ b/mesonbuild/dependencies/pkgconfig.py
@@ -339,7 +339,10 @@ class PkgConfigDependency(ExternalDependency):
elif arg.startswith(('-L', '-I')) or (len(arg) > 2 and arg[1] == ':'):
# clean out improper '\\ ' as comes from some Windows pkg-config files
arg = arg.replace('\\ ', ' ')
+ else:
+ tmpl = None
if len(pargs) > 1 and len(pargs[1]) == 1:
+ assert(tmpl is not None)
arg = tmpl.format(pargs[1], '/'.join(pargs[2:]))
converted.append(arg)
return converted
diff --git a/mesonbuild/linkers/detect.py b/mesonbuild/linkers/detect.py
index 65d77f6..9096a8f 100644
--- a/mesonbuild/linkers/detect.py
+++ b/mesonbuild/linkers/detect.py
@@ -47,6 +47,8 @@ def guess_win_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Ty
check_args = [comp_class.LINKER_PREFIX + '/logo', comp_class.LINKER_PREFIX + '--version']
elif isinstance(comp_class.LINKER_PREFIX, list):
check_args = comp_class.LINKER_PREFIX + ['/logo'] + comp_class.LINKER_PREFIX + ['--version']
+ else:
+ sys.exit('Internal error, check_args not set properly.')
check_args += env.coredata.get_external_link_args(for_machine, comp_class.language)
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index bdbb59e..15e3395 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -61,7 +61,7 @@ def get_meson_introspection_types(coredata: T.Optional[cdata.CoreData] = None,
installdata = backend.create_install_data()
interpreter = backend.interpreter
else:
- benchmarkdata = testdata = installdata = None
+ interpreter = benchmarkdata = testdata = installdata = None
# Enforce key order for argparse
return collections.OrderedDict([
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index a8b0185..85b6859 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -308,6 +308,8 @@ class _Logger:
label = [red('ERROR:')]
elif severity is _Severity.DEPRECATION:
label = [red('DEPRECATION:')]
+ else:
+ sys.exit('Internal error, invalid enum value.')
# rargs is a tuple, not a list
args = label + list(rargs)
diff --git a/mesonbuild/modules/dlang.py b/mesonbuild/modules/dlang.py
index 34fea90..68a79c9 100644
--- a/mesonbuild/modules/dlang.py
+++ b/mesonbuild/modules/dlang.py
@@ -93,6 +93,7 @@ class DlangModule(ExtensionModule):
def check_dub(self, state):
dubbin = state.find_program('dub', silent=True)
+ out = None
if dubbin.found():
try:
p, out = Popen_safe(dubbin.get_command() + ['--version'])[0:2]
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 410bf74..0ec9591 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -440,6 +440,8 @@ class GnomeModule(ExtensionModule):
depend_files, depends, subdirs = self._get_gresource_dependencies(
state, ifile, source_dirs, dependencies)
+ else:
+ depend_files = []
# Make source dirs relative to build dir now
source_dirs = [os.path.join(state.build_to_src, state.subdir, d) for d in source_dirs]
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index ebe0d92..e686ece 100644
--- a/mesonbuild/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -481,8 +481,9 @@ class PkgConfigModule(NewExtensionModule):
prefix = PurePath(state.environment.get_build_dir())
srcdir = PurePath(state.environment.get_source_dir())
else:
- outdir = state.environment.scratch_dir
+ outdir = state.environment.get_scratch_dir()
prefix = PurePath(_as_str(coredata.get_option(mesonlib.OptionKey('prefix'))))
+ srcdir = state.environment.get_source_dir()
if pkgroot:
pkgroot_ = PurePath(pkgroot)
if not pkgroot_.is_absolute():
diff --git a/mesonbuild/scripts/clangformat.py b/mesonbuild/scripts/clangformat.py
index 9ce0504..5a49c52 100644
--- a/mesonbuild/scripts/clangformat.py
+++ b/mesonbuild/scripts/clangformat.py
@@ -19,6 +19,7 @@ def run_clang_format(fname: Path, exelist: T.List[str], check: bool, cformat_ver
if version_compare(cformat_ver, '>=10'):
clangformat_10 = True
exelist = exelist + ['--dry-run', '--Werror']
+ original = b''
else:
original = fname.read_bytes()
before = fname.stat().st_mtime
diff --git a/mesonbuild/scripts/coverage.py b/mesonbuild/scripts/coverage.py
index bded052..ce882ee 100644
--- a/mesonbuild/scripts/coverage.py
+++ b/mesonbuild/scripts/coverage.py
@@ -15,6 +15,7 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build
if gcovr_exe == '':
gcovr_exe = None
+ gcovr_Version = '0'
else:
gcovr_exe, gcovr_version = environment.detect_gcovr(gcovr_exe)
if llvm_cov_exe == '' or not mesonlib.exe_exists([llvm_cov_exe, '--version']):