@@ -99,10 +99,10 @@ def from_cli_args(self, profiles, settings, options, conf, cwd, context=None):
9999 def load_profile (self , profile_name , cwd = None , context = None ):
100100 # TODO: This can be made private, only used in testing now
101101 cwd = cwd or os .getcwd ()
102- profile = self ._load_profile (profile_name , cwd , context )
102+ profile = self ._load_profile (profile_name , cwd , context , root_profile_name = profile_name )
103103 return profile
104104
105- def _load_profile (self , profile_name , cwd , context ):
105+ def _load_profile (self , profile_name , cwd , context , root_profile_name ):
106106 """ Will look for "profile_name" in disk if profile_name is absolute path,
107107 in current folder if path is relative or in the default folder otherwise.
108108 return: a Profile object
@@ -122,6 +122,7 @@ def _load_profile(self, profile_name, cwd, context):
122122 "subprocess" : subprocess ,
123123 "profile_dir" : base_path ,
124124 "profile_name" : file_path ,
125+ "root_profile_name" : root_profile_name ,
125126 "conan_version" : conan_version ,
126127 "detect_api" : detect_api ,
127128 "context" : context }
@@ -138,11 +139,11 @@ def _load_profile(self, profile_name, cwd, context):
138139 f"Check your Jinja2 syntax: { str (e )} " )
139140
140141 try :
141- return self ._recurse_load_profile (text , profile_path , context )
142+ return self ._recurse_load_profile (text , profile_path , context , profile_name )
142143 except ConanException as exc :
143144 raise ConanException ("Error reading '%s' profile: %s" % (profile_name , exc ))
144145
145- def _recurse_load_profile (self , text , profile_path , context ):
146+ def _recurse_load_profile (self , text , profile_path , context , root_profile_name ):
146147 """ Parse and return a Profile object from a text config like representation.
147148 cwd is needed to be able to load the includes
148149 """
@@ -154,7 +155,7 @@ def _recurse_load_profile(self, text, profile_path, context):
154155 # from parent profiles
155156 for include in profile_parser .includes :
156157 # Recursion !!
157- profile = self ._load_profile (include , cwd , context )
158+ profile = self ._load_profile (include , cwd , context , root_profile_name )
158159 inherited_profile .compose_profile (profile )
159160
160161 # Current profile before update with parents (but parent variables already applied)
0 commit comments