[FL-2481] Renamed assets->resources; enforcing Manifest build if it does not exist (#1135)

* Renamed assets->resources; enforcing Manifest build if it does not exist
* Rebuild resources from CI
* Added Manifest to repo - be sure to rebuild it with `make -C assets` before committing changes!
* Actually added Manifest.
* Keeping Manifest on assets clean
* Spelling fix in Makefile
This commit is contained in:
hedger
2022-04-19 22:02:37 +03:00
committed by GitHub
parent 956788c09b
commit 57312961e8
17 changed files with 343 additions and 68 deletions

View File

@@ -3,13 +3,13 @@ from collections import OrderedDict
class FsNode:
class Type(Enum):
class NodeType(Enum):
File = 0
Directory = 1
def __init__(self, name: str, type: "FsNode.Type", **kwargs):
def __init__(self, name: str, nodetype: "FsNode.Type", **kwargs):
self.name = name
self.type = type
self.nodetype = nodetype
self.data = kwargs
self.parent = None
self.children = OrderedDict()
@@ -25,7 +25,7 @@ class FsNode:
parent_node = self.traverse(fragments)
if not parent_node:
raise Exception(f"No parent node found for: {path}")
parent_node.addChild(FsNode(name, FsNode.Type.Directory))
parent_node.addChild(FsNode(name, FsNode.NodeType.Directory))
def addFile(self, path, md5, size):
fragments = path.split("/")
@@ -34,7 +34,7 @@ class FsNode:
parent_node = self.traverse(fragments)
if not parent_node:
raise Exception(f"No parent node found for: {path}")
parent_node.addChild(FsNode(name, FsNode.Type.File, md5=md5, size=size))
parent_node.addChild(FsNode(name, FsNode.NodeType.File, md5=md5, size=size))
def getChild(self, name):
return self.children[name]
@@ -58,19 +58,37 @@ class FsNode:
def dump(self):
ret = {}
ret["name"] = (self.name,)
ret["type"] = (self.type,)
ret["type"] = (self.nodetype,)
ret["path"] = (self.getPath(),)
if len(self.children):
ret["children"] = [node.dump() for node in self.children.values()]
return ret
def walk_nodes(node: FsNode):
yield node
for child in node.children.values():
yield from walk_nodes(child)
# Returns filenames: [only_in_left], [changed], [only_in_right]
def compare_fs_trees(left: FsNode, right: FsNode):
# import pprint
# pprint.pprint(left.dump())
# pprint.pprint(right.dump())
left_dict = dict((node.getPath(), node) for node in walk_nodes(left))
right_dict = dict((node.getPath(), node) for node in walk_nodes(right))
only_in_left = []
changed = []
only_in_right = []
return [], [], []
left_names = set(left_dict.keys())
right_names = set(right_dict.keys())
common_names = left_names.intersection(right_names)
return (
list(left_names - right_names),
list(
name
for name in common_names
if left_dict[name].data != right_dict[name].data
),
list(right_names - left_names),
)