11# #
2- # Copyright 2009-2014 Ghent University
2+ # Copyright 2009-2015 Ghent University
33#
44# This file is part of EasyBuild,
55# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
5252from easybuild .tools import config , filetools
5353from easybuild .framework .easyconfig import EASYCONFIGS_PKG_SUBDIR
5454from easybuild .framework .easyconfig .easyconfig import ITERATE_OPTIONS , EasyConfig , ActiveMNS
55- from easybuild .framework .easyconfig .easyconfig import fetch_parameter_from_easyconfig_file
5655from easybuild .framework .easyconfig .easyconfig import get_easyblock_class , get_module_path , resolve_template
56+ from easybuild .framework .easyconfig .parser import fetch_parameters_from_easyconfig
5757from easybuild .framework .easyconfig .tools import get_paths_for
5858from easybuild .framework .easyconfig .templates import TEMPLATE_NAMES_EASYBLOCK_RUN_STEP
5959from easybuild .tools .build_details import get_build_stats
@@ -937,7 +937,7 @@ def make_module_req(self):
937937 txt = "\n "
938938 for key in sorted (requirements ):
939939 for path in requirements [key ]:
940- paths = glob .glob (path )
940+ paths = sorted ( glob .glob (path ) )
941941 if paths :
942942 txt += self .module_generator .prepend_paths (key , paths )
943943 try :
@@ -1652,7 +1652,10 @@ def make_module_step(self, fake=False):
16521652
16531653 self .log .info ("Module file %s written" % self .module_generator .filename )
16541654
1655- self .modules_tool .update ()
1655+ # only update after generating final module file
1656+ if not fake :
1657+ self .modules_tool .update ()
1658+
16561659 self .module_generator .create_symlinks ()
16571660
16581661 if not fake :
@@ -1825,15 +1828,17 @@ def run_all_steps(self, run_test_cases):
18251828 return True
18261829
18271830
1828- def build_and_install_one (module , orig_environ ):
1831+ def build_and_install_one (ecdict , orig_environ ):
18291832 """
18301833 Build the software
1831- @param module : dictionary contaning parsed easyconfig + metadata
1834+ @param ecdict : dictionary contaning parsed easyconfig + metadata
18321835 @param orig_environ: original environment (used to reset environment)
18331836 """
18341837 silent = build_option ('silent' )
18351838
1836- spec = module ['spec' ]
1839+ spec = ecdict ['spec' ]
1840+ rawtxt = ecdict ['ec' ].rawtxt
1841+ name = ecdict ['ec' ]['name' ]
18371842
18381843 print_msg ("processing EasyBuild easyconfig %s" % spec , log = _log , silent = silent )
18391844
@@ -1847,12 +1852,11 @@ def build_and_install_one(module, orig_environ):
18471852 # load easyblock
18481853 easyblock = build_option ('easyblock' )
18491854 if not easyblock :
1850- easyblock = fetch_parameter_from_easyconfig_file ( spec , 'easyblock' )
1855+ easyblock = fetch_parameters_from_easyconfig ( rawtxt , [ 'easyblock' ])[ 0 ]
18511856
1852- name = module ['ec' ]['name' ]
18531857 try :
18541858 app_class = get_easyblock_class (easyblock , name = name )
1855- app = app_class (module ['ec' ])
1859+ app = app_class (ecdict ['ec' ])
18561860 _log .info ("Obtained application instance of for %s (easyblock: %s)" % (name , easyblock ))
18571861 except EasyBuildError , err :
18581862 tup = (name , easyblock , err .msg )
@@ -1909,9 +1913,9 @@ def build_and_install_one(module, orig_environ):
19091913 # upload spec to central repository
19101914 currentbuildstats = app .cfg ['buildstats' ]
19111915 repo = init_repository (get_repository (), get_repositorypath ())
1912- if 'original_spec' in module :
1916+ if 'original_spec' in ecdict :
19131917 block = det_full_ec_version (app .cfg ) + ".block"
1914- repo .add_easyconfig (module ['original_spec' ], app .name , block , buildstats , currentbuildstats )
1918+ repo .add_easyconfig (ecdict ['original_spec' ], app .name , block , buildstats , currentbuildstats )
19151919 repo .add_easyconfig (spec , app .name , det_full_ec_version (app .cfg ), buildstats , currentbuildstats )
19161920 repo .commit ("Built %s" % app .full_mod_name )
19171921 del repo
@@ -1976,22 +1980,23 @@ def build_and_install_one(module, orig_environ):
19761980 return (success , application_log , errormsg )
19771981
19781982
1979- def get_easyblock_instance (easyconfig ):
1983+ def get_easyblock_instance (ecdict ):
19801984 """
19811985 Get an instance for this easyconfig
19821986 @param easyconfig: parsed easyconfig (EasyConfig instance)
19831987
19841988 returns an instance of EasyBlock (or subclass thereof)
19851989 """
1986- spec = easyconfig ['spec' ]
1987- name = easyconfig ['ec' ]['name' ]
1990+ spec = ecdict ['spec' ]
1991+ rawtxt = ecdict ['ec' ].rawtxt
1992+ name = ecdict ['ec' ]['name' ]
19881993
19891994 # handle easyconfigs with custom easyblocks
19901995 # determine easyblock specification from easyconfig file, if any
1991- easyblock = fetch_parameter_from_easyconfig_file ( spec , 'easyblock' )
1996+ easyblock = fetch_parameters_from_easyconfig ( rawtxt , [ 'easyblock' ])[ 0 ]
19921997
19931998 app_class = get_easyblock_class (easyblock , name = name )
1994- return app_class (easyconfig ['ec' ])
1999+ return app_class (ecdict ['ec' ])
19952000
19962001
19972002def build_easyconfigs (easyconfigs , output_dir , test_results ):
0 commit comments