@@ -1074,7 +1074,7 @@ def make_builddir(self):
10741074 self .log .info ("Overriding 'cleanupoldinstall' (to False), 'cleanupoldbuild' (to True) "
10751075 "and 'keeppreviousinstall' because we're building in the installation directory." )
10761076 # force cleanup before installation
1077- if build_option ('module_only' ):
1077+ if build_option ('module_only' ) or self . cfg [ 'module_only' ] :
10781078 self .log .debug ("Disabling cleanupoldbuild because we run as module-only" )
10791079 self .cfg ['cleanupoldbuild' ] = False
10801080 else :
@@ -1145,7 +1145,7 @@ def make_dir(self, dir_name, clean, dontcreateinstalldir=False):
11451145 if self .cfg ['keeppreviousinstall' ]:
11461146 self .log .info ("Keeping old directory %s (hopefully you know what you are doing)" , dir_name )
11471147 return
1148- elif build_option ('module_only' ):
1148+ elif build_option ('module_only' ) or self . cfg [ 'module_only' ] :
11491149 self .log .info ("Not touching existing directory %s in module-only mode..." , dir_name )
11501150 elif clean :
11511151 remove_dir (dir_name )
@@ -1371,7 +1371,7 @@ def make_module_dep(self, unload_info=None):
13711371 multi_dep_mod_names [dep ['name' ]].append (dep ['short_mod_name' ])
13721372
13731373 multi_dep_load_defaults = []
1374- for depname , depmods in sorted (multi_dep_mod_names .items ()):
1374+ for _ , depmods in sorted (multi_dep_mod_names .items ()):
13751375 stmt = self .module_generator .load_module (depmods [0 ], multi_dep_mods = depmods ,
13761376 recursive_unload = recursive_unload ,
13771377 depends_on = depends_on )
@@ -1775,10 +1775,7 @@ def make_extension_string(self, name_version_sep='-', ext_sep=', ', sort=True):
17751775 return ext_sep .join (exts_list )
17761776
17771777 def prepare_for_extensions (self ):
1778- """
1779- Also do this before (eg to set the template)
1780- """
1781- pass
1778+ """Ran before installing extensions (eg to set templates)"""
17821779
17831780 def skip_extensions (self ):
17841781 """
@@ -2120,7 +2117,7 @@ def guess_start_dir(self):
21202117 start_dir = ''
21212118 # do not use the specified 'start_dir' when running as --module-only as
21222119 # the directory will not exist (extract_step is skipped)
2123- if self .start_dir and not build_option ('module_only' ):
2120+ if self .start_dir and not build_option ('module_only' ) and not self . cfg [ 'module_only' ] :
21242121 start_dir = self .start_dir
21252122
21262123 if not os .path .isabs (start_dir ):
@@ -2204,9 +2201,9 @@ def handle_iterate_opts(self):
22042201 self .log .info ("Current iteration index: %s" , self .iter_idx )
22052202
22062203 # pop first element from all iterative easyconfig parameters as next value to use
2207- for opt in self .iter_opts :
2208- if len (self . iter_opts [ opt ] ) > self .iter_idx :
2209- self .cfg [opt ] = self . iter_opts [ opt ] [self .iter_idx ]
2204+ for opt , value in self .iter_opts . items () :
2205+ if len (value ) > self .iter_idx :
2206+ self .cfg [opt ] = value [self .iter_idx ]
22102207 else :
22112208 self .cfg [opt ] = '' # empty list => empty option as next value
22122209 self .log .debug ("Next value for %s: %s" % (opt , str (self .cfg [opt ])))
@@ -2218,12 +2215,12 @@ def post_iter_step(self):
22182215 """Restore options that were iterated over"""
22192216 # disable templating, since we're messing about with values in self.cfg
22202217 with self .cfg .disable_templating ():
2221- for opt in self .iter_opts :
2222- self .cfg [opt ] = self . iter_opts [ opt ]
2218+ for opt , value in self .iter_opts . items () :
2219+ self .cfg [opt ] = value
22232220
22242221 # also need to take into account extensions, since those were iterated over as well
22252222 for ext in self .ext_instances :
2226- ext .cfg [opt ] = self . iter_opts [ opt ]
2223+ ext .cfg [opt ] = value
22272224
22282225 self .log .debug ("Restored value of '%s' that was iterated over: %s" , opt , self .cfg [opt ])
22292226
@@ -2355,7 +2352,7 @@ def check_readiness_step(self):
23552352 self .log .info ("No module %s found. Not skipping anything." % self .full_mod_name )
23562353
23572354 # remove existing module file under --force (but only if --skip is not used)
2358- elif build_option ('force' ) or build_option ('rebuild' ):
2355+ elif ( build_option ('force' ) or build_option ('rebuild' )) and not build_option ( 'dump_env_script ' ):
23592356 self .remove_module_file ()
23602357
23612358 def fetch_step (self , skip_checksums = False ):
@@ -2613,7 +2610,7 @@ def patch_step(self, beginpath=None, patches=None):
26132610 copy_patch = 'copy' in patch and 'sourcepath' not in patch
26142611
26152612 self .log .debug ("Source index: %s; patch level: %s; source path suffix: %s; copy patch: %s" ,
2616- srcind , level , srcpathsuffix , copy )
2613+ srcind , level , srcpathsuffix , copy_patch )
26172614
26182615 if beginpath is None :
26192616 try :
@@ -2757,10 +2754,7 @@ def _test_step(self):
27572754 self .report_test_failure (err )
27582755
27592756 def stage_install_step (self ):
2760- """
2761- Install in a stage directory before actual installation.
2762- """
2763- pass
2757+ """Install in a stage directory before actual installation."""
27642758
27652759 def install_step (self ):
27662760 """Install built software (abstract method)."""
@@ -3254,7 +3248,7 @@ def sanity_check_linked_shared_libs(self, subdirs=None):
32543248 required_libs .extend (self .cfg ['required_linked_shared_libs' ])
32553249
32563250 # early return if there are no banned/required libraries
3257- if not ( banned_libs + required_libs ) :
3251+ if not banned_libs + required_libs :
32583252 self .log .info ("No banned/required libraries specified" )
32593253 return []
32603254 else :
@@ -3801,7 +3795,7 @@ def make_module_step(self, fake=False):
38013795 try :
38023796 self .make_devel_module ()
38033797 except EasyBuildError as error :
3804- if build_option ('module_only' ):
3798+ if build_option ('module_only' ) or self . cfg [ 'module_only' ] :
38053799 self .log .info ("Using --module-only so can recover from error: %s" , error )
38063800 else :
38073801 raise error
@@ -3909,7 +3903,7 @@ def skip_step(self, step, skippable):
39093903 """Dedice whether or not to skip the specified step."""
39103904 skip = False
39113905 force = build_option ('force' )
3912- module_only = build_option ('module_only' )
3906+ module_only = build_option ('module_only' ) or self . cfg [ 'module_only' ]
39133907 sanity_check_only = build_option ('sanity_check_only' )
39143908 skip_extensions = build_option ('skip_extensions' )
39153909 skip_test_step = build_option ('skip_test_step' )
@@ -4469,7 +4463,7 @@ def copy_easyblocks_for_reprod(easyblock_instances, reprod_dir):
44694463 else :
44704464 easyblock_paths .add (easyblock_path )
44714465 for easyblock_path in easyblock_paths :
4472- easyblock_basedir , easyblock_filename = os .path .split (easyblock_path )
4466+ easyblock_filename = os .path .basename (easyblock_path )
44734467 copy_file (easyblock_path , os .path .join (reprod_easyblock_dir , easyblock_filename ))
44744468 _log .info ("Dumped easyblock %s required for reproduction to %s" , easyblock_filename , reprod_easyblock_dir )
44754469
@@ -4600,10 +4594,7 @@ def build_easyconfigs(easyconfigs, output_dir, test_results):
46004594
46014595
46024596class StopException (Exception ):
4603- """
4604- StopException class definition.
4605- """
4606- pass
4597+ """Exception thrown to stop running steps"""
46074598
46084599
46094600def inject_checksums_to_json (ecs , checksum_type ):
@@ -4651,14 +4642,14 @@ def inject_checksums_to_json(ecs, checksum_type):
46514642
46524643 # actually inject new checksums or overwrite existing ones (if --force)
46534644 existing_checksums = app .get_checksums_from_json (always_read = True )
4654- for filename in checksums :
4645+ for filename , checksum in checksums . items () :
46554646 if filename not in existing_checksums :
4656- existing_checksums [filename ] = checksums [ filename ]
4647+ existing_checksums [filename ] = checksum
46574648 # don't do anything if the checksum already exist and is the same
4658- elif checksums [ filename ] != existing_checksums [filename ]:
4649+ elif checksum != existing_checksums [filename ]:
46594650 if build_option ('force' ):
46604651 print_warning ("Found existing checksums for %s, overwriting them (due to --force)..." % ec_fn )
4661- existing_checksums [filename ] = checksums [ filename ]
4652+ existing_checksums [filename ] = checksum
46624653 else :
46634654 raise EasyBuildError ("Found existing checksum for %s, use --force to overwrite them" % filename )
46644655
0 commit comments