Esempio n. 1
0
    def modFieldBcType(self, fieldPath, patch, newBcType):
        file = ParameterFile(fieldPath)
        file.readFile()
        exp = re.compile(patch + r".*?\{(.*?)\}", re.DOTALL)
        file.readFile()
        [newStr, num] = exp.subn("%s\n  {\n%s\n  }\n" % (patch, newBcType),
                                 file.content)

        if num == 0:
            self.logger.error("Patch: " + patch + "not found in " + file.name +
                              " could not modify bc")
            sys.exit(1)
        else:
            file.content = newStr
            file.writeFile()
Esempio n. 2
0
    def modFieldBcType(self, fieldPath, patch, newBcType):
        file = ParameterFile(fieldPath)
        file.readFile()
        exp = re.compile(patch + r".*?\{(.*?)\}", re.DOTALL)
        file.readFile()
        [newStr, num] = exp.subn(
            "%s\n  {\n%s\n  }\n" % (patch, newBcType),
            file.content
        )

        if num == 0:
            self.logger.error(
                "Patch: " + patch + "not found in " +
                file.name + " could not modify bc"
            )
            sys.exit(1)
        else:
            file.content = newStr
            file.writeFile()
Esempio n. 3
0
    def readFieldBcType(self, fieldPath, patch):
        file = ParameterFile(fieldPath)
        file.readFile()
        exp = re.compile(
            "(" + patch + r"\s*?\n\s*?\{.*?type)(\s*?)(.*?)(;.*?\})",
            re.DOTALL)

        bcMatch = exp.search(file.content)

        if bcMatch is None:
            self.logger.debug("Could not find patch: " + patch + " in file: " +
                              file.name)
        try:
            patchType = bcMatch.group(3)
        except:
            self.logger.error("Could not get patch type from file: " +
                              file.name + " check the file!")
            sys.exit(1)
        return patchType.strip()
Esempio n. 4
0
    def readFieldBcType(self, fieldPath, patch):
        file = ParameterFile(fieldPath)
        file.readFile()
        exp = re.compile(
            "(" + patch + r"\s*?\n\s*?\{.*?type)(\s*?)(.*?)(;.*?\})",
            re.DOTALL
        )

        bcMatch = exp.search(file.content)

        if bcMatch is None:
            self.logger.debug(
                "Could not find patch: " + patch + " in file: " + file.name
            )
        try:
            patchType = bcMatch.group(3)
        except:
            self.logger.error(
                "Could not get patch type from file: " +
                file.name + " check the file!"
            )
            sys.exit(1)
        return patchType.strip()