@@ -111,6 +111,7 @@ def __init__(self, **kwargs):
111111 self .upstreams = kwargs .get ("upstreams" , None )
112112 self .modifypkg = kwargs .get ("modifypkg" , None )
113113 self .keepallcompilers = kwargs .get ("keep_all_compilers" , None )
114+ self .treatwarningsaserrors = kwargs .get ("treat_warnings_as_errors" , None )
114115
115116 if not self .name :
116117 # site = self.site if self.site else 'default'
@@ -187,7 +188,10 @@ def _copy_common_includes(self):
187188 (compiler_name , _ ) = compiler_name_and_version_from_string (self .compiler )
188189 packages_compiler_yaml_path = os .path .join (common_path , f"packages_{ compiler_name } .yaml" )
189190 if not os .path .exists (packages_compiler_yaml_path ):
190- logging .warning (f"\n WARNING: { packages_compiler_yaml_path } not found, please check if this is correct\n " )
191+ if self .treatwarningsaserrors :
192+ raise Exception (f"\n { packages_compiler_yaml_path } not found, please check if this is correct\n " )
193+ else :
194+ logging .warning (f"\n WARNING: { packages_compiler_yaml_path } not found, please check if this is correct\n " )
191195 destination = os .path .join (env_common_dir , "packages.yaml" )
192196 self ._copy_or_merge_includes ("packages" , packages_yaml_path , packages_compiler_yaml_path , destination )
193197
@@ -222,7 +226,10 @@ def _copy_site_includes(self):
222226 packages_yaml_path = os .path .join (site_path , "packages.yaml" )
223227 packages_compiler_yaml_path = os .path .join (site_path , f"packages_{ self .compiler } .yaml" )
224228 if not os .path .exists (packages_compiler_yaml_path ):
225- logging .warning (f"\n WARNING: { packages_compiler_yaml_path } not found, please check if this is correct\n " )
229+ if self .treatwarningsaserrors :
230+ raise Exception (f"\n { packages_compiler_yaml_path } not found, please check if this is correct\n " )
231+ else :
232+ logging .warning (f"\n WARNING: { packages_compiler_yaml_path } not found, please check if this is correct\n " )
226233 destination = os .path .join (env_site_dir , "packages.yaml" )
227234 self ._copy_or_merge_includes ("packages" , packages_yaml_path , packages_compiler_yaml_path , destination )
228235
0 commit comments