MCPcopy Create free account
hub / github.com/0xcaff/codex-web / process_item

Function process_item

scripts/fetch_updates/fetch_updates.py:61–90  ·  view source on GitHub ↗
(version_dir, item)

Source from the content-addressed store, hash-verified

59
60
61def process_item(version_dir, item):
62 version_xml = version_dir / "version.xml"
63
64 if version_xml.is_file():
65 print(f"Already staged {version_dir}")
66 return
67
68 full_enclosure = item.find("enclosure")
69 if full_enclosure is None:
70 raise RuntimeError(f"Missing full update enclosure for {version_dir}")
71
72 version_dir.mkdir(parents=True, exist_ok=True)
73 download_enclosure(
74 full_enclosure,
75 version_dir / "update.zip",
76 )
77
78 for delta in item.findall(f"{sparkle_name('deltas')}/enclosure"):
79 delta_from = safe_path_component(delta.attrib[sparkle_name("deltaFrom")])
80 download_enclosure(
81 delta,
82 version_dir / "deltas" / f"{delta_from}.delta",
83 )
84
85 version_xml.write_text(
86 etree.tostring(item, encoding="unicode", pretty_print=True),
87 encoding="utf-8",
88 )
89
90 print(f"Staged {version_dir}")
91
92
93def run(args: argparse.Namespace) -> None:

Callers 1

runFunction · 0.85

Calls 3

download_enclosureFunction · 0.85
sparkle_nameFunction · 0.85
safe_path_componentFunction · 0.85

Tested by

no test coverage detected