示例#1
0
 def generateCCode(self, genBatFile , projectPath, *args):
     """
     Generate C code for ESDL project by running the bat file code-generation-cli.bat
     e.g. 
     1. With no argument 
     C:/Program Files (x86)/ETAS/ISOLAR-CODER1.2.0/code-generation-cli.bat -w <workspace> -p <project name>
     
     2. With another argument
     C:/Program Files (x86)/ETAS/ISOLAR-CODER1.2.0/code-generation-cli.bat -w <workspace> -p <project name> -d truncate        
     """
     self._logger.info("Generate C Code: %s" % projectPath)
     if (exists(projectPath)):
         wp, prjName = projectPath.rsplit(os.sep, 1);
         cmd = [genBatFile, "-w", wp, "-p", prjName]
         for arg in args:
             cmd += arg.split(" ")   
         output, err, code = runWindowCommand(cmd)
         
         if "ERROR" in err:
             self._logger.info("Generate C Code: %s - FAIL" % projectPath)
             code = 0
         else:
             self._logger.info("Generate C Code: %s - SUCCEED" % projectPath)
             code = 1
         return (output, err, code)
     else:
         self._logger.error("Project %s cannot be found in workspace" % projectPath)
         raise IOError
示例#2
0
 def compileAndLink(self, mingwMake, cgenPrjPath):
     """
     TODO: description
     """
     
     if(exists(cgenPrjPath)):
         cmd = [mingwMake, "-C", cgenPrjPath]
         self._logger.info("Compile and link: %s" % cgenPrjPath)
         outMsg, errMsg, code = runWindowCommand(cmd);
         self._logger.info("Compile and link: %s - %s" % (cgenPrjPath,"SUCCEED" if code == 0 else "FAIL"))
         return (outMsg, errMsg, not code)
     else:
         self._logger.error("Cannot be found: %s" % cgenPrjPath)
         raise IOError
示例#3
0
    def compareFile(self, ref, des, qcType=""):
        self.logger.info("Beyond Comparing file %s" % ref)

        if not exists(ref):
            self.logger.error("Missing file %s" % ref)
            return 105
        elif not exists(des):
            self.logger.error("Missing file %s" % ref)
            return 105

        if type in ("size", "crc", "binary"):
            self.logger.info("Using Beyond Compare with /qc=" + type)
            cmd = self.bc + " " + ref + " " + des + " /qc=" + type
        else:
            self.logger.info("Using Beyond Compare with default rules")
            cmd = self.bc + " " + ref + " " + des + " /qc"

        rs = runWindowCommand(cmd)
        self.logger.info("Beyond Compare Result: " + self._translateBCReturnCode(rs[2]))
        return rs[2]
示例#4
0
 def _getBeyondCompareExePath(self):
     rs = runWindowCommand('reg query "HKLM\SOFTWARE\\Classes\BeyondCompare.Snapshot\shell\open\command" /ve')
     path = re.search('(?<=REG_SZ).*(?="%1")', rs[0]).group()
     return path.strip()