@@ -395,13 +395,13 @@ def get_checksums_from_json(self, always_read=False):
395395 :param always_read: always read the checksums.json file, even if it has been read before
396396 """
397397 if always_read or self .json_checksums is None :
398- try :
399- path = self . obtain_file ( "checksums.json" , no_download = True )
398+ path = self . obtain_file ( "checksums.json" , no_download = True , warning_only = True )
399+ if path is not None :
400400 self .log .info ("Loading checksums from file %s" , path )
401401 json_txt = read_file (path )
402402 self .json_checksums = json .loads (json_txt )
403- # if the file can't be found, return an empty dict
404- except EasyBuildError :
403+ else :
404+ # if the file can't be found, return an empty dict
405405 self .json_checksums = {}
406406
407407 return self .json_checksums
@@ -736,7 +736,8 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
736736 return exts_sources
737737
738738 def obtain_file (self , filename , extension = False , urls = None , download_filename = None , force_download = False ,
739- git_config = None , no_download = False , download_instructions = None , alt_location = None ):
739+ git_config = None , no_download = False , download_instructions = None , alt_location = None ,
740+ warning_only = False ):
740741 """
741742 Locate the file with the given name
742743 - searches in different subdirectories of source path
@@ -789,7 +790,13 @@ def obtain_file(self, filename, extension=False, urls=None, download_filename=No
789790 return fullpath
790791
791792 except IOError as err :
792- raise EasyBuildError ("Downloading file %s from url %s to %s failed: %s" , filename , url , fullpath , err )
793+ if not warning_only :
794+ raise EasyBuildError ("Downloading file %s "
795+ "from url %s to %s failed: %s" , filename , url , fullpath , err )
796+ else :
797+ self .log .warning ("Downloading file %s "
798+ "from url %s to %s failed: %s" , filename , url , fullpath , err )
799+ return None
793800
794801 else :
795802 # try and find file in various locations
@@ -866,8 +873,13 @@ def obtain_file(self, filename, extension=False, urls=None, download_filename=No
866873 self .dry_run_msg (" * %s (MISSING)" , filename )
867874 return filename
868875 else :
869- raise EasyBuildError ("Couldn't find file %s anywhere, and downloading it is disabled... "
876+ if not warning_only :
877+ raise EasyBuildError ("Couldn't find file %s anywhere, and downloading it is disabled... "
878+ "Paths attempted (in order): %s " , filename , ', ' .join (failedpaths ))
879+ else :
880+ self .log .warning ("Couldn't find file %s anywhere, and downloading it is disabled... "
870881 "Paths attempted (in order): %s " , filename , ', ' .join (failedpaths ))
882+ return None
871883 elif git_config :
872884 return get_source_tarball_from_git (filename , targetdir , git_config )
873885 else :
@@ -959,7 +971,11 @@ def obtain_file(self, filename, extension=False, urls=None, download_filename=No
959971 error_msg += "and downloading it didn't work either... "
960972 error_msg += "Paths attempted (in order): %s " % failedpaths_msg
961973
962- raise EasyBuildError (error_msg , filename )
974+ if not warning_only :
975+ raise EasyBuildError (error_msg , filename )
976+ else :
977+ self .log .warning (error_msg , filename )
978+ return None
963979
964980 #
965981 # GETTER/SETTER UTILITY FUNCTIONS
0 commit comments