aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--authors.txt2
-rw-r--r--mesonbuild/backend/backends.py2
-rw-r--r--mesonbuild/build.py9
-rw-r--r--mesonbuild/interpreter.py7
-rw-r--r--mesonbuild/mesonlib.py2
-rw-r--r--mesonbuild/modules/qt4.py9
-rw-r--r--mesonbuild/modules/qt5.py9
-rw-r--r--mesonbuild/modules/windows.py4
-rw-r--r--mesonbuild/scripts/depfixer.py7
-rw-r--r--syntax-highlighting/vim/indent/meson.vim (renamed from syntax-highlighting/vim/plugin/meson.vim)6
-rw-r--r--syntax-highlighting/vim/syntax/meson.vim2
11 files changed, 34 insertions, 25 deletions
diff --git a/authors.txt b/authors.txt
index 12e944e..2c2a4df 100644
--- a/authors.txt
+++ b/authors.txt
@@ -58,3 +58,5 @@ Paulo Antonio Alvarez
Olexa Bilaniuk
Daniel Stone
Marc-Antoine Perennou
+Matthieu Gautier
+Kseniia Vasilchuk
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 10167e8..934f274 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -338,7 +338,7 @@ class Backend():
commands += compiler.get_always_args()
if no_warn_args:
commands += compiler.get_no_warn_args()
- else:
+ elif self.environment.coredata.get_builtin_option('buildtype') != 'plain':
commands += compiler.get_warn_args(self.environment.coredata.get_builtin_option('warning_level'))
commands += compiler.get_option_compile_args(self.environment.coredata.compiler_options)
commands += self.build.get_global_args(compiler)
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 3750f77..c7d4125 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -911,6 +911,15 @@ class Generator():
def get_arglist(self):
return self.arglist
+ def process_files(self, name, files, state, extra_args=[]):
+ output = GeneratedList(self, extra_args=extra_args)
+ for f in files:
+ if not isinstance(f, str):
+ raise InvalidArguments('{} arguments must be strings.'.format(name))
+ output.add_file(os.path.join(state.subdir, f))
+ return output
+
+
class GeneratedList():
def __init__(self, generator, extra_args=[]):
if hasattr(generator, 'held_object'):
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index e86f779..0f6ea1c 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -318,11 +318,10 @@ class GeneratorHolder(InterpreterObject):
self.methods.update({'process' : self.process_method})
def process_method(self, args, kwargs):
- check_stringlist(args)
extras = mesonlib.stringlistify(kwargs.get('extra_args', []))
- gl = GeneratedListHolder(self, extras)
- [gl.add_file(os.path.join(self.interpreter.subdir, a)) for a in args]
- return gl
+ gl = self.held_object.process_files('Generator', args, self.interpreter, extra_args=extras)
+ return GeneratedListHolder(gl)
+
class GeneratedListHolder(InterpreterObject):
def __init__(self, arg1, extra_args=[]):
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index 5250cd3..c4f6769 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -318,7 +318,7 @@ def do_conf_file(src, dst, confdata):
line = do_replacement(regex, line, confdata)
result.append(line)
dst_tmp = dst + '~'
- with open(dst_tmp, 'w') as f:
+ with open(dst_tmp, 'w', encoding='utf-8') as f:
f.writelines(result)
shutil.copymode(src, dst_tmp)
replace_if_different(dst, dst_tmp)
diff --git a/mesonbuild/modules/qt4.py b/mesonbuild/modules/qt4.py
index 2d89792..8df4f3e 100644
--- a/mesonbuild/modules/qt4.py
+++ b/mesonbuild/modules/qt4.py
@@ -140,22 +140,19 @@ class Qt4Module():
ui_kwargs = {'output' : 'ui_@BASENAME@.h',
'arguments' : ['-o', '@OUTPUT@', '@INPUT@']}
ui_gen = build.Generator([self.uic], ui_kwargs)
- ui_output = build.GeneratedList(ui_gen)
- [ui_output.add_file(os.path.join(state.subdir, a)) for a in ui_files]
+ ui_output = ui_gen.process_files('Qt4 ui', ui_files, state)
sources.append(ui_output)
if len(moc_headers) > 0:
moc_kwargs = {'output' : 'moc_@BASENAME@.cpp',
'arguments' : ['@INPUT@', '-o', '@OUTPUT@']}
moc_gen = build.Generator([self.moc], moc_kwargs)
- moc_output = build.GeneratedList(moc_gen)
- [moc_output.add_file(os.path.join(state.subdir, a)) for a in moc_headers]
+ moc_output = moc_gen.process_files('Qt4 moc header', moc_headers, state)
sources.append(moc_output)
if len(moc_sources) > 0:
moc_kwargs = {'output' : '@BASENAME@.moc',
'arguments' : ['@INPUT@', '-o', '@OUTPUT@']}
moc_gen = build.Generator([self.moc], moc_kwargs)
- moc_output = build.GeneratedList(moc_gen)
- [moc_output.add_file(os.path.join(state.subdir, a)) for a in moc_sources]
+ moc_output = moc_gen.process_files('Qt4 moc source', moc_sources, state)
sources.append(moc_output)
return sources
diff --git a/mesonbuild/modules/qt5.py b/mesonbuild/modules/qt5.py
index 35a475a..d4cd261 100644
--- a/mesonbuild/modules/qt5.py
+++ b/mesonbuild/modules/qt5.py
@@ -146,22 +146,19 @@ class Qt5Module():
ui_kwargs = {'output' : 'ui_@BASENAME@.h',
'arguments' : ['-o', '@OUTPUT@', '@INPUT@']}
ui_gen = build.Generator([self.uic], ui_kwargs)
- ui_output = build.GeneratedList(ui_gen)
- [ui_output.add_file(os.path.join(state.subdir, a)) for a in ui_files]
+ ui_output = ui_gen.process_files('Qt5 ui', ui_files, state)
sources.append(ui_output)
if len(moc_headers) > 0:
moc_kwargs = {'output' : 'moc_@BASENAME@.cpp',
'arguments' : ['@INPUT@', '-o', '@OUTPUT@']}
moc_gen = build.Generator([self.moc], moc_kwargs)
- moc_output = build.GeneratedList(moc_gen)
- [moc_output.add_file(os.path.join(state.subdir, a)) for a in moc_headers]
+ moc_output = moc_gen.process_files('Qt5 moc header', moc_headers, state)
sources.append(moc_output)
if len(moc_sources) > 0:
moc_kwargs = {'output' : '@BASENAME@.moc',
'arguments' : ['@INPUT@', '-o', '@OUTPUT@']}
moc_gen = build.Generator([self.moc], moc_kwargs)
- moc_output = build.GeneratedList(moc_gen)
- [moc_output.add_file(os.path.join(state.subdir, a)) for a in moc_sources]
+ moc_output = moc_gen.process_files('Qt5 moc source', moc_sources, state)
sources.append(moc_output)
return sources
diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py
index ad882cb..012f4d0 100644
--- a/mesonbuild/modules/windows.py
+++ b/mesonbuild/modules/windows.py
@@ -40,12 +40,10 @@ class WindowsModule:
suffix = 'o'
if not rescomp.found():
raise MesonException('Could not find Windows resource compiler %s.' % ' '.join(rescomp.get_command()))
- res_files = mesonlib.stringlistify(args)
res_kwargs = {'output' : '@BASENAME@.' + suffix,
'arguments': res_args}
res_gen = build.Generator([rescomp], res_kwargs)
- res_output = build.GeneratedList(res_gen)
- [res_output.add_file(os.path.join(state.subdir, a)) for a in res_files]
+ res_output = res_gen.process_files('Windows resource', args, state)
return res_output
def initialize():
diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py
index ed77b56..baa401e 100644
--- a/mesonbuild/scripts/depfixer.py
+++ b/mesonbuild/scripts/depfixer.py
@@ -196,6 +196,8 @@ class Elf(DataSizes):
def parse_dynamic(self):
sec = self.find_section(b'.dynamic')
self.dynamic = []
+ if sec is None:
+ return
self.bf.seek(sec.sh_offset)
while True:
e = DynamicEntry(self.bf, self.ptrsize, self.is_le)
@@ -218,6 +220,9 @@ class Elf(DataSizes):
soname = i
if i.d_tag == DT_STRTAB:
strtab = i
+ else:
+ print("This file does not have a soname")
+ return
self.bf.seek(strtab.val + soname.val)
print(self.read_str())
@@ -300,6 +305,8 @@ class Elf(DataSizes):
def remove_rpath_entry(self, entrynum):
sec = self.find_section(b'.dynamic')
+ if sec is None:
+ return None
for (i, entry) in enumerate(self.dynamic):
if entry.d_tag == entrynum:
rpentry = self.dynamic[i]
diff --git a/syntax-highlighting/vim/plugin/meson.vim b/syntax-highlighting/vim/indent/meson.vim
index b219bdc..b00c942 100644
--- a/syntax-highlighting/vim/plugin/meson.vim
+++ b/syntax-highlighting/vim/indent/meson.vim
@@ -23,15 +23,15 @@ if exists("*GetMesonIndent")
finish
endif
let s:keepcpo= &cpo
-set cpo&vim
+setlocal cpo&vim
" Come here when loading the script the first time.
let s:maxoff = 50 " maximum number of lines to look backwards for ()
" Force sw=2 sts=2 because that's required by convention
-set shiftwidth=2
-set softtabstop=2
+setlocal shiftwidth=2
+setlocal softtabstop=2
function GetMesonIndent(lnum)
echom getline(line("."))
diff --git a/syntax-highlighting/vim/syntax/meson.vim b/syntax-highlighting/vim/syntax/meson.vim
index 21b7453..0799237 100644
--- a/syntax-highlighting/vim/syntax/meson.vim
+++ b/syntax-highlighting/vim/syntax/meson.vim
@@ -27,7 +27,7 @@ endif
" We need nocompatible mode in order to continue lines with backslashes.
" Original setting will be restored.
let s:cpo_save = &cpo
-set cpo&vim
+setlocal cpo&vim
" https://github.com/mesonbuild/meson/wiki/Syntax
syn keyword mesonConditional elif else if endif