Skip to content

Commit

Permalink
add retrieval of buildstats to repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Toon Willems committed Aug 10, 2012
1 parent fec0365 commit 943f360
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion easybuild/tools/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import time

import easybuild
from easybuild.framework.easyblock import EasyBlock
from easybuild.tools.build_log import getLog


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

0 comments on commit 943f360

Please sign in to comment.