8282from easybuild .tools .config import MOD_SEARCH_PATH_HEADERS , PYTHONPATH , SEARCH_PATH_BIN_DIRS , SEARCH_PATH_LIB_DIRS
8383from easybuild .tools .config import build_option , build_path , get_failed_install_build_dirs_path
8484from easybuild .tools .config import get_failed_install_logs_path , get_log_filename , get_repository , get_repositorypath
85- from easybuild .tools .config import install_path , log_path , package_path , source_paths
85+ from easybuild .tools .config import install_path , log_path , package_path , source_paths , source_paths_data
86+ from easybuild .tools .config import DATA , SOFTWARE
8687from easybuild .tools .environment import restore_env , sanitize_env
8788from easybuild .tools .filetools import CHECKSUM_TYPE_SHA256
8889from easybuild .tools .filetools import adjust_permissions , apply_patch , back_up_file , change_dir , check_lock
@@ -167,12 +168,13 @@ def __init__(self, ec, logfile=None):
167168 # list of patch/source files, along with checksums
168169 self .patches = []
169170 self .src = []
171+ self .data_src = []
170172 self .checksums = []
171173 self .json_checksums = None
172174
173175 # build/install directories
174176 self .builddir = None
175- self .installdir = None # software
177+ self .installdir = None # software or data
176178 self .installdir_mod = None # module file
177179
178180 # extensions
@@ -522,11 +524,11 @@ def fetch_sources(self, sources=None, checksums=None):
522524 Add a list of source files (can be tarballs, isos, urls).
523525 All source files will be checked if a file exists (or can be located)
524526
525- :param sources: list of sources to fetch (if None, use 'sources' easyconfig parameter)
527+ :param sources: list of sources to fetch (if None, use 'sources' or 'data_sources' easyconfig parameter)
526528 :param checksums: list of checksums for sources
527529 """
528530 if sources is None :
529- sources = self .cfg ['sources' ]
531+ sources = self .cfg ['sources' ] or self . cfg [ 'data_sources' ]
530532 if checksums is None :
531533 checksums = self .cfg ['checksums' ]
532534
@@ -804,7 +806,10 @@ def obtain_file(self, filename, extension=False, urls=None, download_filename=No
804806 :param download_instructions: instructions to manually add source (used for complex cases)
805807 :param alt_location: alternative location to use instead of self.name
806808 """
807- srcpaths = source_paths ()
809+ if self .cfg ['data_sources' ]:
810+ srcpaths = source_paths_data ()
811+ else :
812+ srcpaths = source_paths ()
808813
809814 # We don't account for the checksums file in the progress bar
810815 if filename != 'checksum.json' :
@@ -1169,7 +1174,10 @@ def gen_installdir(self):
11691174 """
11701175 Generate the name of the installation directory.
11711176 """
1172- basepath = install_path ()
1177+ if self .cfg ['data_sources' ]:
1178+ basepath = install_path (DATA )
1179+ else :
1180+ basepath = install_path (SOFTWARE )
11731181 if basepath :
11741182 self .install_subdir = ActiveMNS ().det_install_subdir (self .cfg )
11751183 self .installdir = os .path .join (os .path .abspath (basepath ), self .install_subdir )
@@ -2598,8 +2606,10 @@ def fetch_step(self, skip_checksums=False):
25982606 # fetch sources
25992607 if self .cfg ['sources' ]:
26002608 self .fetch_sources (self .cfg ['sources' ], checksums = self .cfg ['checksums' ])
2609+ elif self .cfg ['data_sources' ]:
2610+ self .fetch_sources (self .cfg ['data_sources' ], checksums = self .cfg ['checksums' ])
26012611 else :
2602- self .log .info ('no sources provided' )
2612+ self .log .info ('no sources or data_sources provided' )
26032613
26042614 if self .dry_run :
26052615 # actual list of patches is printed via _obtain_file_dry_run method
@@ -5108,8 +5118,8 @@ def make_checksum_lines(checksums, indent_level):
51085118 if app .src :
51095119 placeholder = '# PLACEHOLDER FOR SOURCES/PATCHES WITH CHECKSUMS'
51105120
5111- # grab raw lines for source_urls, sources, patches
5112- keys = ['patches' , 'source_urls' , 'sources' ]
5121+ # grab raw lines for source_urls, sources, data_sources, patches
5122+ keys = ['data_sources' , ' patches' , 'source_urls' , 'sources' ]
51135123 raw = {}
51145124 for key in keys :
51155125 regex = re .compile (r'^(%s(?:.|\n)*?\])\s*$' % key , re .M )
@@ -5123,10 +5133,12 @@ def make_checksum_lines(checksums, indent_level):
51235133 # inject combination of source_urls/sources/patches/checksums into easyconfig
51245134 # by replacing first occurence of placeholder that was put in place
51255135 sources_raw = raw .get ('sources' , '' )
5136+ data_sources_raw = raw .get ('data_sources' , '' )
51265137 source_urls_raw = raw .get ('source_urls' , '' )
51275138 patches_raw = raw .get ('patches' , '' )
51285139 regex = re .compile (placeholder + '\n ' , re .M )
5129- ectxt = regex .sub (source_urls_raw + sources_raw + patches_raw + checksums_txt + '\n ' , ectxt , count = 1 )
5140+ ectxt = regex .sub (source_urls_raw + sources_raw + data_sources_raw + patches_raw + checksums_txt + '\n ' ,
5141+ ectxt , count = 1 )
51305142
51315143 # get rid of potential remaining placeholders
51325144 ectxt = regex .sub ('' , ectxt )
0 commit comments