Ejemplo n.º 1
0
    def report(self, text, job, verbose=False, catalog=False, error=False):
        '''Report to console and send email notifications if jobs are
        configured to do so'''
        assert job in self.cf.sections()
        cf = getattr(self.cf, job)

        text += "Job name:\t\t%s \n" % job
        mail_text = text
        if catalog:
            text += "Catalog id:\t\t%s\nStatus Code:\t\t%s \n" % (catalog.id,
                    catalog.status)
            mail_text = text + "Transcript:\n\n%s\n" % reindent(catalog.log, 4)
            if verbose:
                text += "Transcript:\n\n%s\n" % reindent(catalog.log, 4)

        try:
            if error:
                if cf.send_email:
                    send_email(cf, mail_text, error=True)
            else:
                if cf.send_email and cf.report_success:
                    send_email(cf, mail_text)
        except socket.error, e:
            self.stdout.write(
                "ERROR, could not contact to the smtp server: \n")
            self.stdout.write(reindent(e.message, 4) + "\n")
Ejemplo n.º 2
0
 def _get_code(self):
      
     if self.group_statements == []:
         self._code = ""
     else:   
         if self.gfunc is not None:
             self._code = self.gfunc.call_signature
             indent_space = self.gfunc.indent_space
         else:
             indent_space = 0
             
         self._code += ' \n'.join(reindent(statement.call_signature,indent_space) \
                                  for statement in self.group_statements)    
     return self._code
Ejemplo n.º 3
0
    def _get_code(self):

        if self.group_statements == []:
            self._code = ""
        else:
            if self.gfunc is not None:
                self._code = self.gfunc.call_signature
                indent_space = self.gfunc.indent_space
            else:
                indent_space = 0

            self._code += ' \n'.join(reindent(statement.call_signature,indent_space) \
                                     for statement in self.group_statements)
        return self._code
Ejemplo n.º 4
0
def main(args):

    cmd_dict = {"cmake": args.cmd_cmake, "make": args.cmd_make}

    deps_dict = generate_deps_dict(cmd_dict)
    deps_list = sorted(deps_dict.keys())

    if args.list:
        print("Dependencies available for installation:\n" +
              reindent("\n".join(deps_list), 4))
        return

    if not args.deps:  # Means that no positional argument is provided
        for name in deps_list:
            deps_dict[name].install()
    else:
        for name in args.deps:
            deps_dict[name].install()