@ -269,7 +269,6 @@ class Interpreter(InterpreterBase, HoldableObject):
subproject_dir : str = ' subprojects ' ,
subproject_dir : str = ' subprojects ' ,
default_project_options : T . Optional [ T . Dict [ OptionKey , str ] ] = None ,
default_project_options : T . Optional [ T . Dict [ OptionKey , str ] ] = None ,
ast : T . Optional [ mparser . CodeBlockNode ] = None ,
ast : T . Optional [ mparser . CodeBlockNode ] = None ,
is_translated : bool = False ,
relaxations : T . Optional [ T . Set [ InterpreterRuleRelaxation ] ] = None ,
relaxations : T . Optional [ T . Set [ InterpreterRuleRelaxation ] ] = None ,
user_defined_options : T . Optional [ coredata . SharedCMDOptions ] = None ,
user_defined_options : T . Optional [ coredata . SharedCMDOptions ] = None ,
) - > None :
) - > None :
@ -283,6 +282,7 @@ class Interpreter(InterpreterBase, HoldableObject):
self . modules : T . Dict [ str , NewExtensionModule ] = { }
self . modules : T . Dict [ str , NewExtensionModule ] = { }
self . subproject_dir = subproject_dir
self . subproject_dir = subproject_dir
self . relaxations = relaxations or set ( )
self . relaxations = relaxations or set ( )
self . build_def_files : mesonlib . OrderedSet [ str ] = mesonlib . OrderedSet ( )
if ast is None :
if ast is None :
self . load_root_meson_file ( )
self . load_root_meson_file ( )
else :
else :
@ -305,16 +305,6 @@ class Interpreter(InterpreterBase, HoldableObject):
self . build_holder_map ( )
self . build_holder_map ( )
self . user_defined_options = user_defined_options
self . user_defined_options = user_defined_options
self . compilers : PerMachine [ T . Dict [ str , ' compilers.Compiler ' ] ] = PerMachine ( { } , { } )
self . compilers : PerMachine [ T . Dict [ str , ' compilers.Compiler ' ] ] = PerMachine ( { } , { } )
# build_def_files needs to be defined before parse_project is called
#
# For non-meson subprojects, we'll be using the ast. Even if it does
# exist we don't want to add a dependency on it, it's autogenerated
# from the actual build files, and is just for reference.
self . build_def_files : mesonlib . OrderedSet [ str ] = mesonlib . OrderedSet ( )
if not is_translated :
build_filename = os . path . join ( self . subdir , environment . build_filename )
self . build_def_files . add ( build_filename )
self . parse_project ( )
self . parse_project ( )
self . _redetect_machines ( )
self . _redetect_machines ( )
@ -339,6 +329,11 @@ class Interpreter(InterpreterBase, HoldableObject):
self . builtin [ ' target_machine ' ] = \
self . builtin [ ' target_machine ' ] = \
OBJ . MachineHolder ( self . build . environment . machines . target , self )
OBJ . MachineHolder ( self . build . environment . machines . target , self )
def load_root_meson_file ( self ) - > None :
build_filename = os . path . join ( self . subdir , environment . build_filename )
self . build_def_files . add ( build_filename )
super ( ) . load_root_meson_file ( )
def build_func_dict ( self ) - > None :
def build_func_dict ( self ) - > None :
self . funcs . update ( { ' add_global_arguments ' : self . func_add_global_arguments ,
self . funcs . update ( { ' add_global_arguments ' : self . func_add_global_arguments ,
' add_global_link_arguments ' : self . func_add_global_link_arguments ,
' add_global_link_arguments ' : self . func_add_global_link_arguments ,
@ -968,8 +963,7 @@ class Interpreter(InterpreterBase, HoldableObject):
new_build = self . build . copy ( )
new_build = self . build . copy ( )
subi = Interpreter ( new_build , self . backend , subp_name , subdir , self . subproject_dir ,
subi = Interpreter ( new_build , self . backend , subp_name , subdir , self . subproject_dir ,
default_options , ast = ast , is_translated = ( ast is not None ) ,
default_options , ast = ast , relaxations = relaxations ,
relaxations = relaxations ,
user_defined_options = self . user_defined_options )
user_defined_options = self . user_defined_options )
# Those lists are shared by all interpreters. That means that
# Those lists are shared by all interpreters. That means that
# even if the subproject fails, any modification that the subproject
# even if the subproject fails, any modification that the subproject