@@ -373,7 +373,8 @@ def fetch_source(self, source, checksum=None, extension=False, download_instruct
373373 :param checksum: checksum corresponding to source
374374 :param extension: flag if being called from collect_exts_file_info()
375375 """
376- filename , download_filename , extract_cmd , source_urls , git_config = None , None , None , None , None
376+ filename , download_filename , extract_cmd = None , None , None
377+ source_urls , git_config , alt_location = None , None , None
377378
378379 if source is None :
379380 raise EasyBuildError ("fetch_source called with empty 'source' argument" )
@@ -387,6 +388,7 @@ def fetch_source(self, source, checksum=None, extension=False, download_instruct
387388 download_filename = source .pop ('download_filename' , None )
388389 source_urls = source .pop ('source_urls' , None )
389390 git_config = source .pop ('git_config' , None )
391+ alt_location = source .pop ('alt_location' , None )
390392 if source :
391393 raise EasyBuildError ("Found one or more unexpected keys in 'sources' specification: %s" , source )
392394
@@ -401,7 +403,7 @@ def fetch_source(self, source, checksum=None, extension=False, download_instruct
401403 force_download = build_option ('force_download' ) in [FORCE_DOWNLOAD_ALL , FORCE_DOWNLOAD_SOURCES ]
402404 path = self .obtain_file (filename , extension = extension , download_filename = download_filename ,
403405 force_download = force_download , urls = source_urls , git_config = git_config ,
404- download_instructions = download_instructions )
406+ download_instructions = download_instructions , alt_location = alt_location )
405407 if path is None :
406408 raise EasyBuildError ('No file found for source %s' , filename )
407409
@@ -468,7 +470,9 @@ def fetch_patches(self, patch_specs=None, extension=False, checksums=None):
468470 patch_info ['postinstall' ] = patch_spec in post_install_patches
469471
470472 force_download = build_option ('force_download' ) in [FORCE_DOWNLOAD_ALL , FORCE_DOWNLOAD_PATCHES ]
471- path = self .obtain_file (patch_info ['name' ], extension = extension , force_download = force_download )
473+ alt_location = patch_info .pop ('alt_location' , None )
474+ path = self .obtain_file (patch_info ['name' ], extension = extension , force_download = force_download ,
475+ alt_location = alt_location )
472476 if path :
473477 self .log .debug ('File %s found for patch %s' , path , patch_spec )
474478 patch_info ['path' ] = path
@@ -517,11 +521,13 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
517521 for ext in exts_list :
518522 if isinstance (ext , (list , tuple )) and ext :
519523 # expected format: (name, version, options (dict))
520- ext_name = ext [0 ]
524+ # name and version can use templates, resolved via parent EC
525+
526+ ext_name = resolve_template (ext [0 ], self .cfg .template_values )
521527 if len (ext ) == 1 :
522528 exts_sources .append ({'name' : ext_name })
523529 else :
524- ext_version = ext [1 ]
530+ ext_version = resolve_template ( ext [1 ], self . cfg . template_values )
525531
526532 # make sure we grab *raw* dict of default options for extension,
527533 # since it may use template values like %(name)s & %(version)s
@@ -687,7 +693,7 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
687693 return exts_sources
688694
689695 def obtain_file (self , filename , extension = False , urls = None , download_filename = None , force_download = False ,
690- git_config = None , download_instructions = None ):
696+ git_config = None , download_instructions = None , alt_location = None ):
691697 """
692698 Locate the file with the given name
693699 - searches in different subdirectories of source path
@@ -698,11 +704,18 @@ def obtain_file(self, filename, extension=False, urls=None, download_filename=No
698704 :param download_filename: filename with which the file should be downloaded, and then renamed to <filename>
699705 :param force_download: always try to download file, even if it's already available in source path
700706 :param git_config: dictionary to define how to download a git repository
707+ :param download_instructions: instructions to manually add source (used for complex cases)
708+ :param alt_location: alternative location to use instead of self.name
701709 """
702710 srcpaths = source_paths ()
703711
704712 update_progress_bar (PROGRESS_BAR_DOWNLOAD_ALL , label = filename )
705713
714+ if alt_location is None :
715+ location = self .name
716+ else :
717+ location = alt_location
718+
706719 # should we download or just try and find it?
707720 if re .match (r"^(https?|ftp)://" , filename ):
708721 # URL detected, so let's try and download it
@@ -711,7 +724,7 @@ def obtain_file(self, filename, extension=False, urls=None, download_filename=No
711724 filename = url .split ('/' )[- 1 ]
712725
713726 # figure out where to download the file to
714- filepath = os .path .join (srcpaths [0 ], letter_dir_for (self . name ), self . name )
727+ filepath = os .path .join (srcpaths [0 ], letter_dir_for (location ), location )
715728 if extension :
716729 filepath = os .path .join (filepath , "extensions" )
717730 self .log .info ("Creating path %s to download file to" % filepath )
@@ -750,8 +763,8 @@ def obtain_file(self, filename, extension=False, urls=None, download_filename=No
750763
751764 for path in ebpath + common_filepaths + srcpaths :
752765 # create list of candidate filepaths
753- namepath = os .path .join (path , self . name )
754- letterpath = os .path .join (path , letter_dir_for (self . name ), self . name )
766+ namepath = os .path .join (path , location )
767+ letterpath = os .path .join (path , letter_dir_for (location ), location )
755768
756769 # most likely paths
757770 candidate_filepaths = [
@@ -790,8 +803,8 @@ def obtain_file(self, filename, extension=False, urls=None, download_filename=No
790803
791804 break # no need to try other source paths
792805
793- name_letter = self . name .lower ()[0 ]
794- targetdir = os .path .join (srcpaths [0 ], name_letter , self . name )
806+ name_letter = location .lower ()[0 ]
807+ targetdir = os .path .join (srcpaths [0 ], name_letter , location )
795808
796809 if foundfile :
797810 if self .dry_run :
@@ -808,7 +821,7 @@ def obtain_file(self, filename, extension=False, urls=None, download_filename=No
808821 source_urls .extend (self .cfg ['source_urls' ])
809822
810823 # add https://sources.easybuild.io as fallback source URL
811- source_urls .append (EASYBUILD_SOURCES_URL + '/' + os .path .join (name_letter , self . name ))
824+ source_urls .append (EASYBUILD_SOURCES_URL + '/' + os .path .join (name_letter , location ))
812825
813826 mkdir (targetdir , parents = True )
814827
@@ -1754,7 +1767,13 @@ def install_extensions(self, install=True):
17541767
17551768 if build_option ('parallel_extensions_install' ):
17561769 self .log .experimental ("installing extensions in parallel" )
1757- self .install_extensions_parallel (install = install )
1770+ try :
1771+ self .install_extensions_parallel (install = install )
1772+ except NotImplementedError :
1773+ # If parallel extension install is not supported for this type of extension then install sequentially
1774+ msg = "Parallel extensions install not supported for %s - using sequential install" % self .name
1775+ self .log .experimental (msg )
1776+ self .install_extensions_sequential (install = install )
17581777 else :
17591778 self .install_extensions_sequential (install = install )
17601779
0 commit comments