Ejemplo n.º 1
0
 def __init__(self, filename):
     path = real_path(os.path.join(os.path.dirname(__file__),
                      os.path.pardir, os.path.pardir, "templates"))
     f = open(os.path.join(path, filename), "r")
     try:
         text = f.read()
     finally:
         f.close()
     self.template = string.Template(text)
Ejemplo n.º 2
0
    def run(self):
        self.log.info("Running update %r %r" % (self.version, self.name))
        db = self.db.rules

        query = db.query(RulesPhase.rules, RulesPhase.version).distinct( \
                RulesPhase.rules, RulesPhase.version)
        for rulesphase in query:
            rules_name = rulesphase[0]
            rules_version = rulesphase[1]
            handler = RulesHandler(self.config, rules_name, rules_version)
            rules = handler.rules
            install_directories = InstallDirectories(rules_name,
                                                     rules_version)
            install_directories.build = real_path(rules.build_path)
            install_directories.source = real_path(rules.src_path)
            install_directories.destroot = real_path(rules.destroot_path)
            self.log.debug("Update install_directories %r" % install_directories)
            db.merge(install_directories)

        db.commit()
        return True