| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| """ |
| The CentOS Artwork Repository framework structure. |
| |
| """ |
| |
| import string |
| import os |
| import re |
| |
| from repository import Repo |
| |
| class Framework: |
| """ |
| This structure provides attributes and methods needed by CentOS |
| artwork repository framework structures. |
| """ |
| |
| def __init__(self): |
| self.fw = {} |
| |
| def find(self,id): |
| """ |
| Return a dictionary object containing information about |
| frameworks. This function explores the repository structure |
| looking for framework directories. Framework directories are |
| defined as regular directories containing at least the |
| subdirectory `tpl/' in its first level. |
| """ |
| repo = Repo() |
| rootdir = str(repo.abspath + repo.workline[0]) |
| template = re.compile('^.*/tpl/?$') |
| for root, dirs, files in os.walk(rootdir): |
| if id in root and template.match(root): |
| print root |
| |
| |
| |
| def getPathId(self, path): |
| """ |
| Return the framework's path id by cleaning up its string path. |
| """ |
| |
| |
| |
| pass |
| |
| def add(self, pathid): |
| """ |
| Return the framework's templates, translations and manuals paths. |
| """ |
| templates = str('trunk/' + pathid + '/tpl') |
| translations = str('trunk/Translations/' + pathid) |
| manuals = str('trunk/Manuals/' + pathid) |
| return (templates, translations, manuals) |
| |
| def list(self, id): |
| """ |
| Print available frameworks and its paths. |
| """ |
| self.find(id) |
| for k, v in self.fw.iteritems(): |
| pathid = k |
| templates, translations, manuals = v |
| print '%12s: %s' % ('Id', pathid) |
| print '%12s: %s' % ('Templates', templates) |
| print '%12s: %s' % ('Translations', translations) |
| print '%12s: %s' % ('Manuals', manuals) |
| print '-'*66 |