Ejemplo n.º 1
0
 def __ConvertFromSync(
     self, contentState: BuildState.BasicContent
 ) -> JsonRecipePackageContentState:
     # Convert to local state objects so our saved json dont accidentially get affected by changes to
     # BuildState.BasicContent and BuildState.BasicContentState
     res = JsonRecipePackageContentState()
     for entry in contentState.Directories:
         res.Directories.append(entry)
     for state in contentState.Files:
         res.AddFile(state.Name, state.Length, state.ModifiedDate,
                     state.Checksum, state.TagChecksum)
     res.Sort()
     return res
Ejemplo n.º 2
0
 def __init__(self, jsonDict: JsonDictType) -> None:
     super().__init__()
     self.PackageName = jsonDict[
         BuildInfoFileElements.PackageName]  # type: str
     self.PackageDependencies = jsonDict[
         BuildInfoFileElements.PackageDependencies]  # type: List[str]
     self.FileFormatVersion = jsonDict[
         BuildInfoFileElements.FileFormatVersion]  # type: str
     self.RecipeHash = jsonDict[
         BuildInfoFileElements.RecipeHash]  # type: str
     self.ContentState = jsonDict[
         BuildInfoFileElements.
         ContentState]  # type: JsonRecipePackageContentState
     self.ContentStateHash = jsonDict[
         BuildInfoFileElements.ContentStateHash]  # type: str
     self.DecodedPackageDependencies = [
         BuildInfoFilePackageDependency(entry)
         for entry in self.PackageDependencies
     ]
     # Optional entries
     self.SourceState = jsonDict[
         BuildInfoFileElements.
         SourceState] if BuildInfoFileElements.SourceState in jsonDict else JsonRecipePackageContentState(
         )  # type: JsonRecipePackageContentState
     self.SourceStateHash = jsonDict[
         BuildInfoFileElements.
         SourceStateHash] if BuildInfoFileElements.SourceStateHash in jsonDict else ""  # type: str
    def DecodeJson(jsonDict: JsonDictType) -> JsonRecipePackageContentState:
        directories = jsonDict["Directories"]  # type: List[str]
        files = jsonDict["Files"]  # type: List[Dict[str,str]]

        result = JsonRecipePackageContentState()
        for entry in directories:
            result.Directories.append(entry)
        for fileEntry in files:
            result.Files.append(
                BuildInfoComplexJsonDecoder.DecodeJsonFileState(fileEntry))
        return result
Ejemplo n.º 4
0
 def __ConvertToSync(
     self, contentState: JsonRecipePackageContentState
 ) -> BuildState.BasicContent:
     contentState.Sort()
     # From local state objects to BuildState.BasicContent
     res = BuildState.BasicContent()
     for entry in contentState.Directories:
         res.Directories.append(entry)
     for state in contentState.Files:
         res.AddFile(state.Name, state.Length, state.ModifiedDate,
                     state.Checksum, state.TagChecksum)
     return res