[FL-3174] Dolphin builder in ufbt; minor ufbt/fbt improvements (#2601)

* ufbt: added "dolphin_ext" target (expects "external" subfolder in cwd with dolphin assets); cleaned up unused code
* ufbt: codestyle fixes
* scripts: fixed style according to ruff linter
* scripts: additional cleanup & codestyle fixes
* github: pass target hw code when installing local SDK with ufbt
* ufbt: added error message for missing folder in dolphin builder
* scripts: more linter fixes
* sdk: added flipper_format_stream; ufbt: support for --extra-define
* fbt: reduced amount of global defines
* scripts, fbt: rearranged imports

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
hedger
2023-05-03 08:48:49 +03:00
committed by GitHub
parent 015ab4a024
commit c3ececcf96
73 changed files with 311 additions and 382 deletions
+4 -4
View File
@@ -6,7 +6,7 @@ import xml.etree.ElementTree as ET
import posixpath
import os
from flipper.utils import *
from flipper.utils import file_sha256, timestamp
from flipper.assets.coprobin import CoproBinary, get_stack_type
@@ -45,13 +45,13 @@ class Copro:
cube_manifest = ET.parse(cube_manifest_file)
cube_package = cube_manifest.find("PackDescription")
if not cube_package:
raise Exception(f"Unknown Cube manifest format")
raise Exception("Unknown Cube manifest format")
cube_version = cube_package.get("Patch") or cube_package.get("Release")
if not cube_version or not cube_version.startswith("FW.WB"):
raise Exception(f"Incorrect Cube package or version info")
raise Exception("Incorrect Cube package or version info")
cube_version = cube_version.replace("FW.WB.", "", 1)
if cube_version != reference_cube_version:
raise Exception(f"Unsupported cube version")
raise Exception("Unsupported cube version")
self.version = cube_version
def _getFileName(self, name):
+2 -1
View File
@@ -1,6 +1,7 @@
import struct
import math
import os, os.path
import os
import os.path
import sys
+5 -7
View File
@@ -1,13 +1,11 @@
import multiprocessing
import logging
import os
import sys
import shutil
from collections import Counter
from flipper.utils.fff import *
from flipper.utils.templite import *
from .icon import *
from flipper.utils.fff import FlipperFormatFile
from flipper.utils.templite import Templite
from .icon import ImageTools, file2image
def _convert_image_to_bm(pair: set):
@@ -121,7 +119,7 @@ class DolphinBubbleAnimation:
self.meta["Passive frames"] + self.meta["Active frames"]
== ordered_frames_count
)
except EOFError as e:
except EOFError:
raise Exception("Invalid meta file: too short")
except AssertionError as e:
self.logger.exception(e)
@@ -158,7 +156,7 @@ class DolphinBubbleAnimation:
except AssertionError as e:
self.logger.exception(e)
self.logger.error(
f"Animation {self.name} bubble slot {bubble_slot} got incorrect data: {bubble}"
f"Animation {self.name} bubble slot {bubble['Slot']} got incorrect data: {bubble}"
)
raise Exception("Meta file is invalid: incorrect bubble data")
except EOFError:
+3 -9
View File
@@ -1,9 +1,6 @@
import logging
import argparse
import subprocess
import io
import os
import sys
ICONS_SUPPORTED_FORMATS = ["png"]
@@ -36,11 +33,8 @@ class ImageTools:
@staticmethod
def is_processing_slow():
try:
from PIL import Image, ImageOps
import heatshrink2
return False
except ImportError as e:
except ImportError:
return True
def __init__(self):
@@ -52,7 +46,7 @@ class ImageTools:
try:
from PIL import Image, ImageOps
except ImportError as e:
except ImportError:
self.__pil_unavailable = True
self.logger.info("pillow module is missing, using convert cli util")
return self.png2xbm(file)
@@ -72,7 +66,7 @@ class ImageTools:
try:
import heatshrink2
except ImportError as e:
except ImportError:
self.__hs2_unavailable = True
self.logger.info("heatshrink2 module is missing, using heatshrink cli util")
return self.xbm2hs(data)
+2 -3
View File
@@ -1,11 +1,10 @@
import datetime
import logging
import os
import posixpath
from pathlib import Path
from flipper.utils import *
from flipper.utils.fstree import *
from flipper.utils import timestamp, file_md5
from flipper.utils.fstree import FsNode, compare_fs_trees
MANIFEST_VERSION = 0
+1 -3
View File
@@ -1,7 +1,5 @@
#!/usr/bin/env python3
import logging
import struct
from enum import Enum
from dataclasses import dataclass
@@ -181,7 +179,7 @@ class OptionBytesData:
def gen_values(self):
obref = ObReferenceValuesGenerator()
converted_refs = list(obref.apply(ob) for ob in self.obs)
list(obref.apply(ob) for ob in self.obs)
return obref