Skip to content

Commit

Permalink
Ensure correct line breaks in module footer
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Flamefire committed Sep 23, 2024
1 parent 095e1e5 commit befc8bd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1477,34 +1477,34 @@ 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'])

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):
"""
Expand Down

0 comments on commit befc8bd

Please sign in to comment.