FBT: Only format images in firmware, not ext apps

It was formatting demo screenshots too
There might a better way to detect only icons, but not formatting also means less merge conflicts
This commit is contained in:
Willy-JL
2024-08-12 18:33:09 +02:00
parent c412d00c3a
commit 314554fe3b
3 changed files with 9 additions and 2 deletions

View File

@@ -14,6 +14,7 @@
- FBT: - FBT:
- OFW: Add `-Wundef` to compiler options (by @hedger) - OFW: Add `-Wundef` to compiler options (by @hedger)
- OFW: Ensure that all images conform specification (by @skyhawkillusions & @hedger) - OFW: Ensure that all images conform specification (by @skyhawkillusions & @hedger)
- Don't format images in external apps folder, only firmware (by @Willy-JL)
### Updated: ### Updated:
- Apps: - Apps:

View File

@@ -326,6 +326,7 @@ firmware_env.Append(
IMG_LINT_SOURCES=[ IMG_LINT_SOURCES=[
# Image assets # Image assets
"applications", "applications",
"!applications/external",
"assets", "assets",
], ],
) )

View File

@@ -57,10 +57,15 @@ class ImageLint(App):
def _gather_images(self, folders): def _gather_images(self, folders):
images = [] images = []
for folder in folders: for folder in folders:
for dirpath, _, filenames in os.walk(folder): exclude = folder.startswith("!")
for dirpath, _, filenames in os.walk(folder.removeprefix("!")):
for filename in filenames: for filename in filenames:
if self.is_file_an_icon(filename): if self.is_file_an_icon(filename):
images.append(os.path.join(dirpath, filename)) filepath = os.path.join(dirpath, filename)
if exclude:
images.remove(filepath)
else:
images.append(filepath)
return images return images
def is_file_an_icon(self, filename): def is_file_an_icon(self, filename):