Created
November 26, 2013 13:54
-
-
Save boegel/7658603 to your computer and use it in GitHub Desktop.
legacy Charm++ easyblock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob, os, shutil, re | |
from easybuild.apps.Application import Application | |
from easybuild.buildsoft.fileTools import runrun, convertName | |
class Charm(ConfigureMake): | |
""" | |
Charm++ | |
""" | |
def configure(self): | |
return 'ok' | |
def make(self): | |
paracmd = '' | |
if self.getCfg('parallel'): | |
paracmd = "-j%s" % self.getCfg('parallel') | |
cmd = "./build %s %s" % (self.getCfg('makeopts'), paracmd) | |
runrun(cmd, logall=True, simple=True) | |
def makeInstall(self): | |
""" | |
Tricky one | |
""" | |
src = self.getCfg('startfrom') | |
try: | |
shutil.copytree(src, self.installdir, symlinks=False) | |
except: | |
self.log.exception("Copying %s to installation dir %s failed" % (src, self.installdir)) | |
def makeModuleExtra(self): | |
"""Overwritten from Application to add extra txt | |
- guess the charmarch | |
""" | |
txt = Application.makeModuleExtra(self) | |
base = self.getCfg('makeopts').split(' ') | |
cand = os.listdir(self.installdir) | |
## name starts with arch opt and contains at least one of the compilers | |
## expected structure: charm++ <arch> <c-compiler> | |
reg = re.compile(r"^%s.*?%s" % (base[1], base[2])) | |
tmp = [] | |
for c in cand: | |
## only directories | |
if os.path.isdir(os.path.join(self.installdir, c)): | |
if reg.search(c): | |
tmp.append(c) | |
## should only have one now | |
if not (len(tmp) == 1): | |
self.log.error("Can't determine CHARMARCH from candidate files %s from dir %s with regexp %s" % (cand, self.installdir, "^%s.*?%s" % (base[0], base[1]))) | |
txt += "prepend-path\t\t%sARCH\t%s\n" % (convertName(self.name(), upper=True), tmp[0]) | |
return txt | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
old easyconfig file for Charm++: