()
| 85 | |
| 86 | |
| 87 | def main() -> None: |
| 88 | parser = argparse.ArgumentParser(description=(__doc__ or "").splitlines()[0]) |
| 89 | mode = parser.add_mutually_exclusive_group() |
| 90 | mode.add_argument( |
| 91 | "--sync-files", |
| 92 | action="store_true", |
| 93 | help="Bump version/GUIDs AND re-sync APPDIR from dist/scenedetect/.", |
| 94 | ) |
| 95 | mode.add_argument( |
| 96 | "--sync-only", |
| 97 | action="store_true", |
| 98 | help="Re-sync APPDIR only; leave version/GUID fields untouched (CI use).", |
| 99 | ) |
| 100 | parser.add_argument( |
| 101 | "--dev", |
| 102 | action="store_true", |
| 103 | help=( |
| 104 | "Rename the MSI to PySceneDetect-{ver}-dev-win64.msi so dev-build artifacts " |
| 105 | "are distinguishable from release artifacts. Only valid with --sync-only." |
| 106 | ), |
| 107 | ) |
| 108 | parser.add_argument( |
| 109 | "--version", |
| 110 | dest="version_override", |
| 111 | help="MSI version override (default: derived from scenedetect.__version__).", |
| 112 | ) |
| 113 | args = parser.parse_args() |
| 114 | |
| 115 | if args.dev and not args.sync_only: |
| 116 | sys.exit("--dev is only valid in combination with --sync-only.") |
| 117 | |
| 118 | advinst = find_advinst() |
| 119 | print(f"Using {advinst}") |
| 120 | |
| 121 | if args.sync_only: |
| 122 | print(f"Re-syncing APPDIR in {INSTALLER_AIP.name}") |
| 123 | resync_appdir(advinst) |
| 124 | if args.dev: |
| 125 | version = msi_version(args.version_override or scenedetect.__version__) |
| 126 | dev_name = f"PySceneDetect-{version}-dev-win64.msi" |
| 127 | print(f"Renaming MSI package to {dev_name} (dev build)") |
| 128 | run(advinst, "/SetPackageName", dev_name, "-buildname", "DefaultBuild") |
| 129 | return |
| 130 | |
| 131 | raw_version = args.version_override or scenedetect.__version__ |
| 132 | version = msi_version(raw_version) |
| 133 | if version != raw_version: |
| 134 | print(f"Normalized {raw_version!r} -> {version!r} for AdvancedInstaller") |
| 135 | print(f"Bumping {INSTALLER_AIP.name} to {version}") |
| 136 | |
| 137 | run(advinst, "/SetVersion", version) |
| 138 | run(advinst, "/SetProductCode", "-langid", "1033") |
| 139 | run( |
| 140 | advinst, |
| 141 | "/SetPackageName", |
| 142 | f"PySceneDetect-{version}-win64.msi", |
| 143 | "-buildname", |
| 144 | "DefaultBuild", |
no test coverage detected