|
|
@ -584,7 +584,7 @@ class Interpreter(InterpreterBase, HoldableObject): |
|
|
|
mlog.warning(f'Module {modname} is now stable, please use the {plainname} module instead.') |
|
|
|
mlog.warning(f'Module {modname} is now stable, please use the {plainname} module instead.') |
|
|
|
return mod |
|
|
|
return mod |
|
|
|
except InvalidArguments: |
|
|
|
except InvalidArguments: |
|
|
|
mlog.warning('Module %s has no backwards or forwards compatibility and might not exist in future releases.' % modname, location=node) |
|
|
|
mlog.warning(f'Module {modname} has no backwards or forwards compatibility and might not exist in future releases.', location=node) |
|
|
|
modname = 'unstable_' + plainname |
|
|
|
modname = 'unstable_' + plainname |
|
|
|
return self._import_module(modname, required) |
|
|
|
return self._import_module(modname, required) |
|
|
|
|
|
|
|
|
|
|
@ -671,8 +671,7 @@ external dependencies (including libraries) must go to "dependencies".''') |
|
|
|
def validate_arguments(self, args, argcount, arg_types): |
|
|
|
def validate_arguments(self, args, argcount, arg_types): |
|
|
|
if argcount is not None: |
|
|
|
if argcount is not None: |
|
|
|
if argcount != len(args): |
|
|
|
if argcount != len(args): |
|
|
|
raise InvalidArguments('Expected %d arguments, got %d.' % |
|
|
|
raise InvalidArguments(f'Expected {argcount} arguments, got {len(args)}.') |
|
|
|
(argcount, len(args))) |
|
|
|
|
|
|
|
for actual, wanted in zip(args, arg_types): |
|
|
|
for actual, wanted in zip(args, arg_types): |
|
|
|
if wanted is not None: |
|
|
|
if wanted is not None: |
|
|
|
if not isinstance(actual, wanted): |
|
|
|
if not isinstance(actual, wanted): |
|
|
@ -798,11 +797,11 @@ external dependencies (including libraries) must go to "dependencies".''') |
|
|
|
if subp_name in self.subproject_stack: |
|
|
|
if subp_name in self.subproject_stack: |
|
|
|
fullstack = self.subproject_stack + [subp_name] |
|
|
|
fullstack = self.subproject_stack + [subp_name] |
|
|
|
incpath = ' => '.join(fullstack) |
|
|
|
incpath = ' => '.join(fullstack) |
|
|
|
raise InvalidCode('Recursive include of subprojects: %s.' % incpath) |
|
|
|
raise InvalidCode(f'Recursive include of subprojects: {incpath}.') |
|
|
|
if subp_name in self.subprojects: |
|
|
|
if subp_name in self.subprojects: |
|
|
|
subproject = self.subprojects[subp_name] |
|
|
|
subproject = self.subprojects[subp_name] |
|
|
|
if required and not subproject.found(): |
|
|
|
if required and not subproject.found(): |
|
|
|
raise InterpreterException('Subproject "%s" required but not found.' % (subproject.subdir)) |
|
|
|
raise InterpreterException(f'Subproject "{subproject.subdir}" required but not found.') |
|
|
|
return subproject |
|
|
|
return subproject |
|
|
|
|
|
|
|
|
|
|
|
r = self.environment.wrap_resolver |
|
|
|
r = self.environment.wrap_resolver |
|
|
@ -968,7 +967,7 @@ external dependencies (including libraries) must go to "dependencies".''') |
|
|
|
except KeyError: |
|
|
|
except KeyError: |
|
|
|
pass |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
raise InterpreterException('Tried to access unknown option "%s".' % optname) |
|
|
|
raise InterpreterException(f'Tried to access unknown option {optname!r}.') |
|
|
|
|
|
|
|
|
|
|
|
@typed_pos_args('get_option', str) |
|
|
|
@typed_pos_args('get_option', str) |
|
|
|
@noKwargs |
|
|
|
@noKwargs |
|
|
@ -1006,7 +1005,7 @@ external dependencies (including libraries) must go to "dependencies".''') |
|
|
|
self.backend = backends.get_backend_from_name(backend, self.build, self) |
|
|
|
self.backend = backends.get_backend_from_name(backend, self.build, self) |
|
|
|
|
|
|
|
|
|
|
|
if self.backend is None: |
|
|
|
if self.backend is None: |
|
|
|
raise InterpreterException('Unknown backend "%s".' % backend) |
|
|
|
raise InterpreterException(f'Unknown backend "{backend}".') |
|
|
|
if backend != self.backend.name: |
|
|
|
if backend != self.backend.name: |
|
|
|
if self.backend.name.startswith('vs'): |
|
|
|
if self.backend.name.startswith('vs'): |
|
|
|
mlog.log('Auto detected Visual Studio backend:', mlog.bold(self.backend.name)) |
|
|
|
mlog.log('Auto detected Visual Studio backend:', mlog.bold(self.backend.name)) |
|
|
@ -1302,7 +1301,7 @@ external dependencies (including libraries) must go to "dependencies".''') |
|
|
|
try: |
|
|
|
try: |
|
|
|
comp = compilers.detect_compiler_for(self.environment, lang, for_machine) |
|
|
|
comp = compilers.detect_compiler_for(self.environment, lang, for_machine) |
|
|
|
if comp is None: |
|
|
|
if comp is None: |
|
|
|
raise InvalidArguments('Tried to use unknown language "%s".' % lang) |
|
|
|
raise InvalidArguments(f'Tried to use unknown language "{lang}".') |
|
|
|
if self.should_skip_sanity_check(for_machine): |
|
|
|
if self.should_skip_sanity_check(for_machine): |
|
|
|
mlog.log_once('Cross compiler sanity tests disabled via the cross file.') |
|
|
|
mlog.log_once('Cross compiler sanity tests disabled via the cross file.') |
|
|
|
else: |
|
|
|
else: |
|
|
@ -1731,8 +1730,8 @@ external dependencies (including libraries) must go to "dependencies".''') |
|
|
|
try: |
|
|
|
try: |
|
|
|
kwargs['input'] = self.source_strings_to_files(extract_as_list(kwargs, 'input')) |
|
|
|
kwargs['input'] = self.source_strings_to_files(extract_as_list(kwargs, 'input')) |
|
|
|
except mesonlib.MesonException: |
|
|
|
except mesonlib.MesonException: |
|
|
|
mlog.warning('''Custom target input \'%s\' can\'t be converted to File object(s). |
|
|
|
mlog.warning(f'''Custom target input '{kwargs['input']}' can't be converted to File object(s). |
|
|
|
This will become a hard error in the future.''' % kwargs['input'], location=self.current_node) |
|
|
|
This will become a hard error in the future.''', location=self.current_node) |
|
|
|
kwargs['env'] = self.unpack_env_kwarg(kwargs) |
|
|
|
kwargs['env'] = self.unpack_env_kwarg(kwargs) |
|
|
|
if 'command' in kwargs and isinstance(kwargs['command'], list) and kwargs['command']: |
|
|
|
if 'command' in kwargs and isinstance(kwargs['command'], list) and kwargs['command']: |
|
|
|
if isinstance(kwargs['command'][0], str): |
|
|
|
if isinstance(kwargs['command'][0], str): |
|
|
@ -1955,8 +1954,7 @@ This will become a hard error in the future.''' % kwargs['input'], location=self |
|
|
|
symlinkless_dir = os.path.realpath(absdir) |
|
|
|
symlinkless_dir = os.path.realpath(absdir) |
|
|
|
build_file = os.path.join(symlinkless_dir, 'meson.build') |
|
|
|
build_file = os.path.join(symlinkless_dir, 'meson.build') |
|
|
|
if build_file in self.processed_buildfiles: |
|
|
|
if build_file in self.processed_buildfiles: |
|
|
|
raise InvalidArguments('Tried to enter directory "%s", which has already been visited.' |
|
|
|
raise InvalidArguments(f'Tried to enter directory "{subdir}", which has already been visited.') |
|
|
|
% subdir) |
|
|
|
|
|
|
|
self.processed_buildfiles.add(build_file) |
|
|
|
self.processed_buildfiles.add(build_file) |
|
|
|
self.subdir = subdir |
|
|
|
self.subdir = subdir |
|
|
|
os.makedirs(os.path.join(self.environment.build_dir, subdir), exist_ok=True) |
|
|
|
os.makedirs(os.path.join(self.environment.build_dir, subdir), exist_ok=True) |
|
|
@ -2182,9 +2180,8 @@ This will become a hard error in the future.''' % kwargs['input'], location=self |
|
|
|
if missing_variables: |
|
|
|
if missing_variables: |
|
|
|
var_list = ", ".join(map(repr, sorted(missing_variables))) |
|
|
|
var_list = ", ".join(map(repr, sorted(missing_variables))) |
|
|
|
mlog.warning( |
|
|
|
mlog.warning( |
|
|
|
"The variable(s) %s in the input file '%s' are not " |
|
|
|
f"The variable(s) {var_list} in the input file '{inputs[0]}' are not " |
|
|
|
"present in the given configuration data." % ( |
|
|
|
"present in the given configuration data.", location=node) |
|
|
|
var_list, inputs[0]), location=node) |
|
|
|
|
|
|
|
if confdata_useless: |
|
|
|
if confdata_useless: |
|
|
|
ifbase = os.path.basename(inputs_abs[0]) |
|
|
|
ifbase = os.path.basename(inputs_abs[0]) |
|
|
|
mlog.warning('Got an empty configuration_data() object and found no ' |
|
|
|
mlog.warning('Got an empty configuration_data() object and found no ' |
|
|
@ -2209,8 +2206,7 @@ This will become a hard error in the future.''' % kwargs['input'], location=self |
|
|
|
mlog.log('Configuring', mlog.bold(output), 'with command') |
|
|
|
mlog.log('Configuring', mlog.bold(output), 'with command') |
|
|
|
res = self.run_command_impl(node, cmd, {}, True) |
|
|
|
res = self.run_command_impl(node, cmd, {}, True) |
|
|
|
if res.returncode != 0: |
|
|
|
if res.returncode != 0: |
|
|
|
raise InterpreterException('Running configure command failed.\n%s\n%s' % |
|
|
|
raise InterpreterException(f'Running configure command failed.\n{res.stdout}\n{res.stderr}') |
|
|
|
(res.stdout, res.stderr)) |
|
|
|
|
|
|
|
if 'capture' in kwargs and kwargs['capture']: |
|
|
|
if 'capture' in kwargs and kwargs['capture']: |
|
|
|
dst_tmp = ofile_abs + '~' |
|
|
|
dst_tmp = ofile_abs + '~' |
|
|
|
file_encoding = kwargs.setdefault('encoding', 'utf-8') |
|
|
|
file_encoding = kwargs.setdefault('encoding', 'utf-8') |
|
|
@ -2343,7 +2339,7 @@ This will become a hard error in the future.''' % kwargs['input'], location=self |
|
|
|
absdir_src = os.path.join(absbase_src, a) |
|
|
|
absdir_src = os.path.join(absbase_src, a) |
|
|
|
absdir_build = os.path.join(absbase_build, a) |
|
|
|
absdir_build = os.path.join(absbase_build, a) |
|
|
|
if not os.path.isdir(absdir_src) and not os.path.isdir(absdir_build): |
|
|
|
if not os.path.isdir(absdir_src) and not os.path.isdir(absdir_build): |
|
|
|
raise InvalidArguments('Include dir %s does not exist.' % a) |
|
|
|
raise InvalidArguments(f'Include dir {a} does not exist.') |
|
|
|
i = build.IncludeDirs(self.subdir, incdir_strings, is_system) |
|
|
|
i = build.IncludeDirs(self.subdir, incdir_strings, is_system) |
|
|
|
return i |
|
|
|
return i |
|
|
|
|
|
|
|
|
|
|
@ -2383,8 +2379,8 @@ This will become a hard error in the future.''' % kwargs['input'], location=self |
|
|
|
raise InterpreterException('is_default option must be a boolean') |
|
|
|
raise InterpreterException('is_default option must be a boolean') |
|
|
|
if is_default: |
|
|
|
if is_default: |
|
|
|
if self.build.test_setup_default_name is not None: |
|
|
|
if self.build.test_setup_default_name is not None: |
|
|
|
raise InterpreterException('\'%s\' is already set as default. ' |
|
|
|
raise InterpreterException(f'{self.build.test_setup_default_name!r} is already set as default. ' |
|
|
|
'is_default can be set to true only once' % self.build.test_setup_default_name) |
|
|
|
'is_default can be set to true only once') |
|
|
|
self.build.test_setup_default_name = setup_name |
|
|
|
self.build.test_setup_default_name = setup_name |
|
|
|
exclude_suites = mesonlib.stringlistify(kwargs.get('exclude_suites', [])) |
|
|
|
exclude_suites = mesonlib.stringlistify(kwargs.get('exclude_suites', [])) |
|
|
|
env = self.unpack_env_kwarg(kwargs) |
|
|
|
env = self.unpack_env_kwarg(kwargs) |
|
|
@ -2599,13 +2595,13 @@ Try setting b_lundef to false instead.'''.format(self.coredata.options[OptionKey |
|
|
|
raise InvalidArguments("Target names starting with 'meson-' are reserved " |
|
|
|
raise InvalidArguments("Target names starting with 'meson-' are reserved " |
|
|
|
"for Meson's internal use. Please rename.") |
|
|
|
"for Meson's internal use. Please rename.") |
|
|
|
if name in coredata.FORBIDDEN_TARGET_NAMES: |
|
|
|
if name in coredata.FORBIDDEN_TARGET_NAMES: |
|
|
|
raise InvalidArguments("Target name '%s' is reserved for Meson's " |
|
|
|
raise InvalidArguments(f"Target name '{name}' is reserved for Meson's " |
|
|
|
"internal use. Please rename." % name) |
|
|
|
"internal use. Please rename.") |
|
|
|
# To permit an executable and a shared library to have the |
|
|
|
# To permit an executable and a shared library to have the |
|
|
|
# same name, such as "foo.exe" and "libfoo.a". |
|
|
|
# same name, such as "foo.exe" and "libfoo.a". |
|
|
|
idname = tobj.get_id() |
|
|
|
idname = tobj.get_id() |
|
|
|
if idname in self.build.targets: |
|
|
|
if idname in self.build.targets: |
|
|
|
raise InvalidCode('Tried to create target "%s", but a target of that name already exists.' % name) |
|
|
|
raise InvalidCode(f'Tried to create target "{name}", but a target of that name already exists.') |
|
|
|
self.build.targets[idname] = tobj |
|
|
|
self.build.targets[idname] = tobj |
|
|
|
if idname not in self.coredata.target_guids: |
|
|
|
if idname not in self.coredata.target_guids: |
|
|
|
self.coredata.target_guids[idname] = str(uuid.uuid4()).upper() |
|
|
|
self.coredata.target_guids[idname] = str(uuid.uuid4()).upper() |
|
|
@ -2738,7 +2734,7 @@ This will become a hard error in the future.''', location=self.current_node) |
|
|
|
continue # This means a generated source and they always exist. |
|
|
|
continue # This means a generated source and they always exist. |
|
|
|
fname = os.path.join(subdir, s) |
|
|
|
fname = os.path.join(subdir, s) |
|
|
|
if not os.path.isfile(fname): |
|
|
|
if not os.path.isfile(fname): |
|
|
|
raise InterpreterException('Tried to add non-existing source file %s.' % s) |
|
|
|
raise InterpreterException(f'Tried to add non-existing source file {s}.') |
|
|
|
|
|
|
|
|
|
|
|
# Only permit object extraction from the same subproject |
|
|
|
# Only permit object extraction from the same subproject |
|
|
|
def validate_extraction(self, buildtarget: mesonlib.HoldableObject) -> None: |
|
|
|
def validate_extraction(self, buildtarget: mesonlib.HoldableObject) -> None: |
|
|
|