@@ -826,19 +826,20 @@ def get_description(self, conflict=True):
826
826
"""
827
827
Generate a description.
828
828
"""
829
- txt = ' \n ' . join ( [
829
+ lines = [
830
830
"proc ModulesHelp { } {" ,
831
831
" puts stderr {%s" % re .sub (r'([{}\[\]])' , r'\\\1' , self ._generate_help_text ()),
832
832
" }" ,
833
833
'}' ,
834
834
'' ,
835
+ ]
836
+
837
+ lines .extend ([
838
+ "module-whatis {%s}" % re .sub (r'([{}\[\]])' , r'\\\1' , line )
839
+ for line in self ._generate_whatis_lines ()
835
840
])
836
841
837
- lines = [
838
- '%(whatis_lines)s' ,
839
- '' ,
840
- "set root %(installdir)s" ,
841
- ]
842
+ lines .extend (['' , "set root " + self .app .installdir ])
842
843
843
844
if self .app .cfg ['moduleloadnoconflict' ]:
844
845
cond_unload = self .conditional_statement (self .is_loaded ('%(name)s' ), "module unload %(name)s" )
@@ -855,18 +856,7 @@ def get_description(self, conflict=True):
855
856
# - 'conflict Compiler/GCC/4.8.2/OpenMPI' for 'Compiler/GCC/4.8.2/OpenMPI/1.6.4'
856
857
lines .extend (['' , "conflict %s" % os .path .dirname (self .app .short_mod_name )])
857
858
858
- whatis_lines = [
859
- "module-whatis {%s}" % re .sub (r'([{}\[\]])' , r'\\\1' , line )
860
- for line in self ._generate_whatis_lines ()
861
- ]
862
- txt += '\n ' .join (['' ] + lines + ['' ]) % {
863
- 'name' : self .app .name ,
864
- 'version' : self .app .version ,
865
- 'whatis_lines' : '\n ' .join (whatis_lines ),
866
- 'installdir' : self .app .installdir ,
867
- }
868
-
869
- return txt
859
+ return '\n ' .join (lines + ['' ])
870
860
871
861
def getenv_cmd (self , envvar , default = None ):
872
862
"""
@@ -1273,29 +1263,24 @@ def get_description(self, conflict=True):
1273
1263
"""
1274
1264
Generate a description.
1275
1265
"""
1276
- txt = ' \n ' . join ( [
1266
+ lines = [
1277
1267
'help(%s%s' % (self .START_STR , self .check_str (self ._generate_help_text ())),
1278
1268
'%s)' % self .END_STR ,
1279
1269
'' ,
1280
- ])
1281
-
1282
- lines = [
1283
- "%(whatis_lines)s" ,
1284
- '' ,
1285
- 'local root = "%(installdir)s"' ,
1286
1270
]
1287
1271
1272
+ for line in self ._generate_whatis_lines ():
1273
+ lines .append ("whatis(%s%s%s)" % (self .START_STR , self .check_str (line ), self .END_STR ))
1274
+
1275
+ lines .extend (['' , 'local root = "%s"' % self .app .installdir ])
1276
+
1288
1277
if self .app .cfg ['moduleloadnoconflict' ]:
1289
1278
self .log .info ("Nothing to do to ensure no conflicts can occur on load when using Lua modules files/Lmod" )
1290
1279
1291
1280
elif conflict :
1292
1281
# conflict on 'name' part of module name (excluding version part at the end)
1293
1282
lines .extend (['' , 'conflict("%s")' % os .path .dirname (self .app .short_mod_name )])
1294
1283
1295
- whatis_lines = []
1296
- for line in self ._generate_whatis_lines ():
1297
- whatis_lines .append ("whatis(%s%s%s)" % (self .START_STR , self .check_str (line ), self .END_STR ))
1298
-
1299
1284
if build_option ('module_extensions' ):
1300
1285
extensions_list = self ._generate_extensions_list ()
1301
1286
@@ -1306,15 +1291,7 @@ def get_description(self, conflict=True):
1306
1291
# https://github.com/TACC/Lmod/issues/428
1307
1292
lines .extend (['' , self .conditional_statement (self .check_version ("8" , "2" , "8" ), extensions_stmt )])
1308
1293
1309
- txt += '\n ' .join (['' ] + lines + ['' ]) % {
1310
- 'name' : self .app .name ,
1311
- 'version' : self .app .version ,
1312
- 'whatis_lines' : '\n ' .join (whatis_lines ),
1313
- 'installdir' : self .app .installdir ,
1314
- 'homepage' : self .app .cfg ['homepage' ],
1315
- }
1316
-
1317
- return txt
1294
+ return '\n ' .join (lines + ['' ])
1318
1295
1319
1296
def getenv_cmd (self , envvar , default = None ):
1320
1297
"""
0 commit comments