PyNeoFile 0.20.2__tar.gz → 0.20.6__tar.gz

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: PyNeoFile
3
- Version: 0.20.2
3
+ Version: 0.20.6
4
4
  Summary: A tar like file format name archivefile.
5
5
  Home-page: https://github.com/GameMaker2k/PyArchiveFile
6
6
  Download-URL: https://github.com/GameMaker2k/PyArchiveFile/neo/master.tar.gz
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyNeoFile
3
- Version: 0.20.2
3
+ Version: 0.20.6
4
4
  Summary: A tar like file format name archivefile.
5
5
  Home-page: https://github.com/GameMaker2k/PyArchiveFile
6
6
  Download-URL: https://github.com/GameMaker2k/PyArchiveFile/neo/master.tar.gz
@@ -60,12 +60,12 @@ __use_ini_name__ = "neofile.ini"
60
60
  __program_name__ = "PyNeoFile"
61
61
  __project__ = __program_name__
62
62
  __project_url__ = "https://github.com/GameMaker2k/PyNeoFile"
63
- __version_info__ = (0, 20, 2, "RC 1", 1)
64
- __version_date_info__ = (2025, 8, 20, "RC 1", 1)
63
+ __version_info__ = (0, 20, 6, "RC 1", 1)
64
+ __version_date_info__ = (2025, 9, 15, "RC 1", 1)
65
65
  __version_date__ = str(__version_date_info__[0]) + "." + str(
66
66
  __version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
67
67
  __revision__ = __version_info__[3]
68
- __revision_id__ = "$Id: d0a21a69779b5fdfb95abb9b8bd56a7f974b8817 $"
68
+ __revision_id__ = "$Id: b79242bccfb046b0c29352e99b75e161278b26e1 $"
69
69
  if(__version_info__[4] is not None):
70
70
  __version_date_plusrc__ = __version_date__ + \
71
71
  "-" + str(__version_date_info__[4])
@@ -93,6 +93,19 @@ def _normalize_algo(algo):
93
93
  return 'auto'
94
94
  return a
95
95
 
96
+ def _normalize_ver_digits(ver_text):
97
+ """
98
+ Make the on-disk version match Archive's strict header check:
99
+ - remove dots
100
+ - strip leading zeros by int() cast when numeric
101
+ Falls back to the raw digits if not purely numeric.
102
+ """
103
+ raw = ver_text.replace(".", "")
104
+ try:
105
+ return str(int(raw)) # "001" -> "1"
106
+ except ValueError:
107
+ return raw # keep as-is if not numeric
108
+
96
109
  def _compress_bytes(data, algo='none', level=None):
97
110
  """Return (stored_bytes, used_algo)."""
98
111
  algo = _normalize_algo(algo)
@@ -440,7 +453,7 @@ def _load_formatspecs_from_ini(paths=None, prefer_section=None):
440
453
  ext = _get('extension', '.neo')
441
454
 
442
455
  delim_real = _decode_delim_escape(delim)
443
- ver_digits = _ver_digits(ver)
456
+ ver_digits = _normalize_ver_digits(_ver_digits(ver))
444
457
 
445
458
  spec = {
446
459
  'format_magic': magic,
@@ -511,7 +524,7 @@ def _checksum(data, cstype, text=False):
511
524
  def _write_global_header(fp, numfiles, encoding, checksumtype, extradata, formatspecs):
512
525
  delim = formatspecs['format_delimiter']
513
526
  magic = formatspecs['format_magic']
514
- ver_digits = _ver_digits(formatspecs.get('format_ver','001'))
527
+ ver_digits = _normalize_ver_digits(_ver_digits(formatspecs.get('format_ver','001')))
515
528
 
516
529
  # extras blob: count + items
517
530
  if isinstance(extradata, dict) and extradata:
@@ -682,6 +695,14 @@ def _parse_global_header(fp, formatspecs, skipchecksum=False):
682
695
  extras.append(_read_cstring(fp, delim).decode('UTF-8'))
683
696
  checksumtype = _read_cstring(fp, delim).decode('UTF-8')
684
697
  _header_cs = _read_cstring(fp, delim).decode('UTF-8')
698
+ # --- Strict check for magic+version against formatspecs ---
699
+ exp_magic = formatspecs.get('format_magic', '')
700
+ exp_ver = _normalize_ver_digits(_ver_digits(formatspecs.get('format_ver', '001')))
701
+ expected_magicver = exp_magic + exp_ver
702
+ if str(magicver) != str(expected_magicver):
703
+ raise ValueError(
704
+ "Bad archive header: magic/version mismatch (got {!r}, expected {!r})".format(magicver, expected_magicver)
705
+ )
685
706
  return {'fencoding': fencoding, 'fnumfiles': fnumfiles, 'fostype': fostype,
686
707
  'fextradata': extras, 'fchecksumtype': checksumtype,
687
708
  'ffilelist': [], 'fformatspecs': formatspecs}
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "PyNeoFile"
3
- version = "0.20.2"
3
+ version = "0.20.6"
4
4
  readme = "README.md"
5
5
  license = { text = "BSD-3-Clause" }
6
6
  keywords = []
File without changes
File without changes
File without changes
File without changes
File without changes