Something went wrong. Try again.
Manifests and a static winget source for jcollie's Windows programs, built and signed on Linux.
Something went wrong. Try again.
1.5 kB · 30 lines
Python
at main
12345678910111213141516171819202122232425262728293031# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us># SPDX-License-Identifier: MIT
import pathlibimport textwrap
def write_manifest(root: pathlib.Path, identifier: str, version: str, *, installer: str = "", locale: str = "", name: str | None = None) -> pathlib.Path: """Write a multi-file manifest under `root` (a manifests/ tree) and return its directory.""" publisher, package = identifier.split(".", 1) directory = root / publisher[0].lower() / publisher / package / version directory.mkdir(parents=True) common = f"PackageIdentifier: {identifier}\nPackageVersion: {version}\n" (directory / f"{identifier}.yaml").write_text( common + "DefaultLocale: en-US\nManifestType: version\nManifestVersion: 1.12.0\n" ) (directory / f"{identifier}.installer.yaml").write_text( common + (textwrap.dedent(installer) if installer else "InstallerType: portable\nInstallers:\n- Architecture: x64\n InstallerUrl: https://example.invalid/a.exe\n InstallerSha256: " + "0" * 64 + "\n") + "ManifestType: installer\nManifestVersion: 1.12.0\n" ) (directory / f"{identifier}.locale.en-US.yaml").write_text( common + f"PackageLocale: en-US\nPublisher: Example Publisher\nPackageName: {name or package}\nLicense: MIT\nShortDescription: A thing.\n" + textwrap.dedent(locale) + "ManifestType: defaultLocale\nManifestVersion: 1.12.0\n" ) return directory