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

Function run

scripts/fetch_updates/fetch_updates.py:93–119  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

91
92
93def run(args: argparse.Namespace) -> None:
94 output_root = Path(args.output).expanduser().resolve()
95 output_root.mkdir(parents=True, exist_ok=True)
96
97 resp = requests.get(APPCAST_URL, timeout=30)
98 resp.raise_for_status()
99
100 snapshot_path = appcast_snapshot_path(output_root)
101 snapshot_path.parent.mkdir(parents=True, exist_ok=True)
102 with snapshot_path.open("xb") as snapshot:
103 snapshot.write(resp.content)
104 print(f"Archived appcast {snapshot_path}")
105
106 root = etree.fromstring(
107 resp.content, parser=etree.XMLParser(resolve_entities=False, no_network=True)
108 )
109 for item in root.findall("./channel/item"):
110 sparkle_version = safe_path_component(item.find(sparkle_name("version")).text)
111 short_version = safe_path_component(
112 item.find(sparkle_name("shortVersionString")).text
113 )
114 version_dir = output_root / "versions" / f"{sparkle_version}-{short_version}"
115
116 try:
117 process_item(version_dir, item)
118 except Exception as e:
119 print(f"error {e} for {version_dir}")
120
121
122def main() -> None:

Callers 1

mainFunction · 0.85

Calls 4

appcast_snapshot_pathFunction · 0.85
safe_path_componentFunction · 0.85
sparkle_nameFunction · 0.85
process_itemFunction · 0.85

Tested by

no test coverage detected