mntm-asset-packer 1.1.2__py3-none-any.whl → 1.1.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mntm-asset-packer
3
- Version: 1.1.2
3
+ Version: 1.1.3
4
4
  Summary: An improved asset packer script to make the process of creating and packing asset packs for the Momentum firmware easier.
5
5
  Author-email: notnotnescap <nescap@tuta.io>
6
6
  Requires-Python: >=3.11
@@ -0,0 +1,5 @@
1
+ mntm_asset_packer.py,sha256=0wSoBAX9JRgwnWrEiMls6_YMpoJv1v-LPF4YPNXlIdg,26940
2
+ mntm_asset_packer-1.1.3.dist-info/METADATA,sha256=OZTt7_-bEkH9Pd17zQqRV6SnjbX80MzMaEQaPzyjT6E,3621
3
+ mntm_asset_packer-1.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
+ mntm_asset_packer-1.1.3.dist-info/entry_points.txt,sha256=CF05qVMVPPNhTroKeH_kkKqVgG-mJ-Q0mSAZHpfxkr0,61
5
+ mntm_asset_packer-1.1.3.dist-info/RECORD,,
mntm_asset_packer.py CHANGED
@@ -172,7 +172,7 @@ def pack_anim(src: pathlib.Path, dst: pathlib.Path) -> None:
172
172
  if not (src / "meta.txt").is_file():
173
173
  print(f'\033[31mNo meta.txt found in "{src.name}" anim.\033[0m')
174
174
  return
175
- if not any(re.match(r"frame_\d+.(png|bm)", file.name) for file in src.iterdir()):
175
+ if not any(re.match(r"frame_\d+\.(png|bm)", file.name) for file in src.iterdir()):
176
176
  print(
177
177
  f'\033[31mNo frames with the required format found in "{src.name}" anim.\033[0m',
178
178
  )
@@ -330,7 +330,11 @@ def pack_font(src: pathlib.Path, dst: pathlib.Path) -> None:
330
330
  """Packs a font."""
331
331
  dst.parent.mkdir(parents=True, exist_ok=True)
332
332
  if src.suffix == ".c":
333
- code = src.read_bytes().split(b' U8G2_FONT_SECTION("')[1].split(b'") =')[1].strip()
333
+ try:
334
+ code = src.read_bytes().split(b' U8G2_FONT_SECTION("')[1].split(b'") =')[1].strip()
335
+ except IndexError:
336
+ print(f'\033[31mError: "{src.name}" is not a valid font file.\033[0m')
337
+ return
334
338
  font = b""
335
339
  for line in code.splitlines():
336
340
  if line.count(b'"') == 2:
@@ -415,7 +419,7 @@ def pack_specific(
415
419
 
416
420
  if packed.exists():
417
421
  try:
418
- if packed.is_dir():
422
+ if packed.is_dir() and not packed.is_symlink():
419
423
  shutil.rmtree(packed, ignore_errors=True)
420
424
  else:
421
425
  packed.unlink()
@@ -1,5 +0,0 @@
1
- mntm_asset_packer.py,sha256=xR-9IpKDWbgfTVBrvDBve_jEhIfy8zT0Od-gau48XzQ,26765
2
- mntm_asset_packer-1.1.2.dist-info/METADATA,sha256=Q6x7aVPiOPYROpKYnmJoR6wBKsuVQlw3YQGI1mel1Es,3621
3
- mntm_asset_packer-1.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
- mntm_asset_packer-1.1.2.dist-info/entry_points.txt,sha256=CF05qVMVPPNhTroKeH_kkKqVgG-mJ-Q0mSAZHpfxkr0,61
5
- mntm_asset_packer-1.1.2.dist-info/RECORD,,