diff --git a/easybuild/tools/module_generator.py b/easybuild/tools/module_generator.py index 851d4131ff..10a2c4432c 100644 --- a/easybuild/tools/module_generator.py +++ b/easybuild/tools/module_generator.py @@ -816,20 +816,19 @@ def get_description(self, conflict=True): """ Generate a description. """ - txt = '\n'.join([ + lines = [ "proc ModulesHelp { } {", " puts stderr {%s" % re.sub(r'([{}\[\]])', r'\\\1', self._generate_help_text()), " }", '}', '', - ]) - - lines = [ - '%(whatis_lines)s', - '', - "set root %(installdir)s", ] + lines.extend([ + "module-whatis {%s}" % re.sub(r'([{}\[\]])', r'\\\1', line) + for line in self._generate_whatis_lines() + ]) + if self.app.cfg['moduleloadnoconflict']: cond_unload = self.conditional_statement(self.is_loaded('%(name)s'), "module unload %(name)s") lines.extend([ @@ -845,18 +844,9 @@ def get_description(self, conflict=True): # - 'conflict Compiler/GCC/4.8.2/OpenMPI' for 'Compiler/GCC/4.8.2/OpenMPI/1.6.4' lines.extend(['', "conflict %s" % os.path.dirname(self.app.short_mod_name)]) - whatis_lines = [ - "module-whatis {%s}" % re.sub(r'([{}\[\]])', r'\\\1', line) - for line in self._generate_whatis_lines() - ] - txt += '\n'.join([''] + lines + ['']) % { - 'name': self.app.name, - 'version': self.app.version, - 'whatis_lines': '\n'.join(whatis_lines), - 'installdir': self.app.installdir, - } + lines.extend(['', "set root %(installdir)s"]) - return txt + return '\n'.join([''] + lines + ['']) def getenv_cmd(self, envvar, default=None): """ @@ -1261,18 +1251,17 @@ def get_description(self, conflict=True): """ Generate a description. """ - txt = '\n'.join([ + lines = [ 'help(%s%s' % (self.START_STR, self.check_str(self._generate_help_text())), '%s)' % self.END_STR, '', - ]) - - lines = [ - "%(whatis_lines)s", - '', - 'local root = "%(installdir)s"', ] + for line in self._generate_whatis_lines(): + lines.append("whatis(%s%s%s)" % (self.START_STR, self.check_str(line), self.END_STR)) + + lines.extend(['', 'local root = "%(installdir)s"']) + if self.app.cfg['moduleloadnoconflict']: self.log.info("Nothing to do to ensure no conflicts can occur on load when using Lua modules files/Lmod") @@ -1280,10 +1269,6 @@ def get_description(self, conflict=True): # conflict on 'name' part of module name (excluding version part at the end) lines.extend(['', 'conflict("%s")' % os.path.dirname(self.app.short_mod_name)]) - whatis_lines = [] - for line in self._generate_whatis_lines(): - whatis_lines.append("whatis(%s%s%s)" % (self.START_STR, self.check_str(line), self.END_STR)) - if build_option('module_extensions'): extensions_list = self._generate_extensions_list() @@ -1294,15 +1279,7 @@ def get_description(self, conflict=True): # https://github.com/TACC/Lmod/issues/428 lines.extend(['', self.conditional_statement(self.check_version("8", "2", "8"), extensions_stmt)]) - txt += '\n'.join([''] + lines + ['']) % { - 'name': self.app.name, - 'version': self.app.version, - 'whatis_lines': '\n'.join(whatis_lines), - 'installdir': self.app.installdir, - 'homepage': self.app.cfg['homepage'], - } - - return txt + return '\n'.join([''] + lines + ['']) def getenv_cmd(self, envvar, default=None): """