From befc8bdacb9c7b857a91c71450111c3913426d20 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Mon, 23 Sep 2024 13:36:22 +0200 Subject: [PATCH] Ensure correct line breaks in module footer The different options for the module footers did not have consistent newline handling: - modtclfooter & modluafooter did append a line break - modules_footer (cmdline) did not Make sure all end with a new line such that they work in combination especially with the EasyBuild version comment moved to the bottom --- easybuild/framework/easyblock.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/easybuild/framework/easyblock.py b/easybuild/framework/easyblock.py index 0b76f5bff2..2a9a411c65 100644 --- a/easybuild/framework/easyblock.py +++ b/easybuild/framework/easyblock.py @@ -1477,21 +1477,21 @@ def make_module_footer(self): """ Insert a footer section in the module file, primarily meant for contextual information """ - footer = [self.module_generator.comment("Built with EasyBuild version %s" % VERBOSE_VERSION)] + footer = [self.module_generator.comment("Built with EasyBuild version %s" % VERBOSE_VERSION).rstrip('\n')] # add extra stuff for extensions (if any) if self.cfg.get_ref('exts_list'): footer.append(self.make_module_extra_extensions()) # include modules footer if one is specified - if self.modules_footer is not None: + if self.modules_footer: self.log.debug("Including specified footer into module: '%s'" % self.modules_footer) footer.append(self.modules_footer) if self.cfg['modtclfooter']: if isinstance(self.module_generator, ModuleGeneratorTcl): self.log.debug("Including Tcl footer in module: %s", self.cfg['modtclfooter']) - footer.extend([self.cfg['modtclfooter'], '\n']) + footer.append(self.cfg['modtclfooter']) else: self.log.warning("Not including footer in Tcl syntax in non-Tcl module file: %s", self.cfg['modtclfooter']) @@ -1499,12 +1499,12 @@ def make_module_footer(self): if self.cfg['modluafooter']: if isinstance(self.module_generator, ModuleGeneratorLua): self.log.debug("Including Lua footer in module: %s", self.cfg['modluafooter']) - footer.extend([self.cfg['modluafooter'], '\n']) + footer.append(self.cfg['modluafooter']) else: self.log.warning("Not including footer in Lua syntax in non-Lua module file: %s", self.cfg['modluafooter']) - return ''.join(footer) + return '\n'.join(footer) def make_module_extend_modpath(self): """