mntm-asset-packer 1.1.2__py3-none-any.whl → 1.1.4__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,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mntm-asset-packer
3
- Version: 1.1.2
3
+ Version: 1.1.4
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
- Requires-Python: >=3.11
7
- Requires-Dist: heatshrink2>=0.13.0
8
- Requires-Dist: pillow>=11.2.1
6
+ Requires-Python: >=3.10
7
+ Requires-Dist: heatshrink2>=0.1.0
8
+ Requires-Dist: pillow>=3.4.0
9
9
  Description-Content-Type: text/markdown
10
10
 
11
11
  # mntm-asset-packer
@@ -66,6 +66,9 @@ If you run the script directly, replace `mntm-asset-packer` with `python3 mntm_a
66
66
  `mntm-asset-packer help`
67
67
  : Displays a detailed help message with all available commands.
68
68
 
69
+ `mntm-asset-packer --version`
70
+ : Displays the version of the asset packer.
71
+
69
72
  `mntm-asset-packer create <Asset Pack Name>`
70
73
  : Creates a directory with the correct file structure to start a new asset pack.
71
74
 
@@ -0,0 +1,5 @@
1
+ mntm_asset_packer.py,sha256=DXDRcpg_Q37bhSaZx4Umla6j8v_JTUzbg-1GRdaApyA,27005
2
+ mntm_asset_packer-1.1.4.dist-info/METADATA,sha256=-DwKWOaSz7RNG1ZoXZQZzyOAq78E0JSdGm8t4TRB558,3694
3
+ mntm_asset_packer-1.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
+ mntm_asset_packer-1.1.4.dist-info/entry_points.txt,sha256=CF05qVMVPPNhTroKeH_kkKqVgG-mJ-Q0mSAZHpfxkr0,61
5
+ mntm_asset_packer-1.1.4.dist-info/RECORD,,
mntm_asset_packer.py CHANGED
@@ -29,6 +29,9 @@ Usage :
29
29
  \033[32mmntm-asset-packer \033[0;33;1mhelp\033[0m
30
30
  \033[3mDisplays this message
31
31
  \033[0m
32
+ \033[32mmntm-asset-packer \033[0;33;1m--version\033[0m
33
+ \033[3mDisplays the version of the asset packer
34
+ \033[0m
32
35
  \033[32mmntm-asset-packer \033[0;33;1mcreate <Asset Pack Name>\033[0m
33
36
  \033[3mCreates a directory with the correct file structure that can be used to prepare for the packing process.
34
37
  \033[0m
@@ -172,7 +175,7 @@ def pack_anim(src: pathlib.Path, dst: pathlib.Path) -> None:
172
175
  if not (src / "meta.txt").is_file():
173
176
  print(f'\033[31mNo meta.txt found in "{src.name}" anim.\033[0m')
174
177
  return
175
- if not any(re.match(r"frame_\d+.(png|bm)", file.name) for file in src.iterdir()):
178
+ if not any(re.match(r"frame_\d+\.(png|bm)", file.name) for file in src.iterdir()):
176
179
  print(
177
180
  f'\033[31mNo frames with the required format found in "{src.name}" anim.\033[0m',
178
181
  )
@@ -330,7 +333,11 @@ def pack_font(src: pathlib.Path, dst: pathlib.Path) -> None:
330
333
  """Packs a font."""
331
334
  dst.parent.mkdir(parents=True, exist_ok=True)
332
335
  if src.suffix == ".c":
333
- code = src.read_bytes().split(b' U8G2_FONT_SECTION("')[1].split(b'") =')[1].strip()
336
+ try:
337
+ code = src.read_bytes().split(b' U8G2_FONT_SECTION("')[1].split(b'") =')[1].strip()
338
+ except IndexError:
339
+ print(f'\033[31mError: "{src.name}" is not a valid font file.\033[0m')
340
+ return
334
341
  font = b""
335
342
  for line in code.splitlines():
336
343
  if line.count(b'"') == 2:
@@ -415,7 +422,7 @@ def pack_specific(
415
422
 
416
423
  if packed.exists():
417
424
  try:
418
- if packed.is_dir():
425
+ if packed.is_dir() and not packed.is_symlink():
419
426
  shutil.rmtree(packed, ignore_errors=True)
420
427
  else:
421
428
  packed.unlink()
@@ -651,7 +658,7 @@ def main() -> None:
651
658
  """Main function."""
652
659
  if len(sys.argv) <= 1:
653
660
  # If no arguments are provided, pack all
654
- here = pathlib.Path(__file__).absolute().parent
661
+ here = pathlib.Path.cwd()
655
662
  start = time.perf_counter()
656
663
  pack_all_asset_packs(here, here / "asset_packs", logger=print)
657
664
  end = time.perf_counter()
@@ -675,7 +682,7 @@ def main() -> None:
675
682
 
676
683
  case "pack":
677
684
  if len(sys.argv) == 3:
678
- here = pathlib.Path(__file__).absolute().parent
685
+ here = pathlib.Path.cwd()
679
686
  start = time.perf_counter()
680
687
 
681
688
  if sys.argv[2] == "all":
@@ -698,7 +705,7 @@ def main() -> None:
698
705
 
699
706
  case "recover":
700
707
  if len(sys.argv) == 3:
701
- here = pathlib.Path(__file__).absolute().parent
708
+ here = pathlib.Path.cwd()
702
709
  start = time.perf_counter()
703
710
 
704
711
  if sys.argv[2] == "all":
@@ -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,,