diff --git a/easybuild/tools/filetools.py b/easybuild/tools/filetools.py index 6e4198e2a6..0ee01a0d04 100644 --- a/easybuild/tools/filetools.py +++ b/easybuild/tools/filetools.py @@ -38,7 +38,6 @@ import easybuild.tools.environment as env from easybuild.tools.asyncprocess import Popen, PIPE, STDOUT, send_all, recv_some from easybuild.tools.build_log import getLog -from easybuild.tools.config import logPath log = getLog('fileTools') @@ -93,7 +92,7 @@ def findBaseDir(): """ def getLocalDirsPurged(): ## e.g. always purge the log directory - ignoreDirs = [logPath()] + ignoreDirs = ["easybuild"] lst = os.listdir(os.getcwd()) for ignDir in ignoreDirs: diff --git a/easybuild/tools/repository.py b/easybuild/tools/repository.py index b2c12d7c72..cfa93ca945 100644 --- a/easybuild/tools/repository.py +++ b/easybuild/tools/repository.py @@ -36,6 +36,7 @@ import time import easybuild +from easybuild.framework.easyblock import EasyBlock from easybuild.tools.build_log import getLog @@ -103,7 +104,13 @@ def cleanup(self): """ Clean up working copy. """ - return + pass + + def get_buildstats(self, name, version): + """ + Get the build statististics for module with name and version + """ + pass class FileRepository(Repository): @@ -153,7 +160,7 @@ def addEasyconfig(self, cfg, name, version, stats, previous): # append a line to the eb file so we don't have git merge conflicts if not previous: - statstemplate = "\n#Build statistics\nbuildstats=[%s]t\n" + statstemplate = "\n#Build statistics\nbuildstats=[%s]\n" else: statstemplate = "\nbuildstats.append(%s)\n" @@ -165,6 +172,23 @@ def addEasyconfig(self, cfg, name, version, stats, previous): return dest + def get_buildstats(self, name, version): + """ + return the build statistics + """ + full_path = os.path.join(self.wc, self.subdir, name) + if not os.path.isdir(full_path): + log.debug("module (%s) has not been found in the repo" % name) + return [] + + dest = os.path.join(full_path, "%s.eb" % version) + if not os.path.isfile(dest): + log.debug("version (%s) of module (%s) has not been found in the repo" % (version, name)) + return [] + + eb = EasyBlock(dest) + return eb['buildstats'] + class GitRepository(FileRepository): """