Skip to content

Commit 773a45a

Browse files
committed
[build] Allow building development .msi artifacts
1 parent bbcf187 commit 773a45a

4 files changed

Lines changed: 49 additions & 5 deletions

File tree

appveyor.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ install:
7272
# CI pyinstaller output - new transitive deps, Python patch updates, etc.).
7373
# Does not touch version/GUID fields - those are committed to the .aip on the
7474
# release tag and must stay stable across rebuilds for upgrade-chain integrity.
75-
- python scripts/bump_installer.py --sync-only
75+
# On non-tag builds, also pass --dev so the MSI is named PySceneDetect-{ver}-dev-win64.msi
76+
# (keeps dev artifacts distinguishable from signed releases).
77+
- if "%APPVEYOR_REPO_TAG%"=="true" (python scripts/bump_installer.py --sync-only) else (python scripts/bump_installer.py --sync-only --dev)
7678
# Create MSI installer
7779
- AdvancedInstaller.com /build packaging/windows/installer/PySceneDetect.aip
7880

scripts/bump_installer.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
python scripts/bump_installer.py # version bump only
1616
python scripts/bump_installer.py --sync-files # bump + re-sync APPDIR
1717
python scripts/bump_installer.py --sync-only # re-sync APPDIR only (CI)
18+
python scripts/bump_installer.py --sync-only --dev # CI dev build (renames MSI)
1819
python scripts/bump_installer.py --version 0.7.0 # explicit version override
1920
2021
The version-bump path rewrites ProductVersion / ProductCode / PackageFileName.
@@ -25,6 +26,11 @@
2526
is already at the release version and we just want the file list to match
2627
CI's pyinstaller output (rather than the developer's local one).
2728
29+
--dev (CI-only, combined with --sync-only) additionally rewrites the MSI
30+
PackageFileName to PySceneDetect-{ver}-dev-win64.msi so dev-build artifacts
31+
can't be confused with release artifacts. ProductVersion and ProductCode
32+
stay untouched - those have to remain stable for upgrade-chain integrity.
33+
2834
All paths shell out to AdvancedInstaller.com so the .aip's invariants
2935
(line endings, attribute ordering, GUID casing) stay intact. The CLI lives
3036
under "C:\\Program Files (x86)\\Caphyon\\Advanced Installer ..\\bin\\x86\\".
@@ -109,19 +115,35 @@ def main() -> None:
109115
action="store_true",
110116
help="Re-sync APPDIR only; leave version/GUID fields untouched (CI use).",
111117
)
118+
parser.add_argument(
119+
"--dev",
120+
action="store_true",
121+
help=(
122+
"Rename the MSI to PySceneDetect-{ver}-dev-win64.msi so dev-build artifacts "
123+
"are distinguishable from release artifacts. Only valid with --sync-only."
124+
),
125+
)
112126
parser.add_argument(
113127
"--version",
114128
dest="version_override",
115129
help="MSI version override (default: derived from scenedetect.__version__).",
116130
)
117131
args = parser.parse_args()
118132

133+
if args.dev and not args.sync_only:
134+
sys.exit("--dev is only valid in combination with --sync-only.")
135+
119136
advinst = find_advinst()
120137
print(f"Using {advinst}")
121138

122139
if args.sync_only:
123140
print(f"Re-syncing APPDIR in {INSTALLER_AIP.name}")
124141
resync_appdir(advinst)
142+
if args.dev:
143+
version = msi_version(args.version_override or scenedetect.__version__)
144+
dev_name = f"PySceneDetect-{version}-dev-win64.msi"
145+
print(f"Renaming MSI package to {dev_name} (dev build)")
146+
run(advinst, "/SetPackageName", dev_name, "-buildname", "DefaultBuild")
125147
return
126148

127149
raw_version = args.version_override or scenedetect.__version__

scripts/pre_release.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818
import sys
1919
from pathlib import Path
2020

21-
REPO_DIR = Path(__file__).resolve().parent.parent
21+
SCRIPTS_DIR = Path(__file__).resolve().parent
22+
REPO_DIR = SCRIPTS_DIR.parent
2223
sys.path.insert(0, str(REPO_DIR))
24+
sys.path.insert(0, str(SCRIPTS_DIR))
25+
26+
from bump_installer import msi_version # noqa: E402
2327

2428
import scenedetect # noqa: E402
2529

@@ -34,8 +38,15 @@
3438

3539
if run_version_check:
3640
installer_aip = INSTALLER_AIP.read_text()
37-
aip_version = f'<ROW Property="ProductVersion" Value="{VERSION}" Options="32"/>'
38-
assert aip_version in installer_aip, f"Installer project version does not match {VERSION}."
41+
# The .aip stores the numeric MSI form (e.g. "0.7.0"), not the Python __version__
42+
# (which may be "0.7-dev0", "0.7", "0.7.1", ...). Normalize through the same
43+
# function bump_installer.py uses to write the .aip so the comparison is apples-to-apples.
44+
expected = msi_version(VERSION)
45+
aip_row = f'<ROW Property="ProductVersion" Value="{expected}" Options="32"/>'
46+
assert aip_row in installer_aip, (
47+
f"Installer ProductVersion does not match normalized {VERSION!r} ({expected!r}). "
48+
f"Run `python scripts/bump_installer.py` to refresh the .aip."
49+
)
3950

4051
with VERSION_INFO.open("wb") as f:
4152
v = VERSION.split(".")

scripts/stage_windows_dist.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,22 @@ def find_7zip() -> Path:
6969
sys.exit("7-Zip not found. Install from https://www.7-zip.org/.")
7070

7171

72+
def _rel(p: Path) -> str:
73+
# Display paths relative to the repo when possible, else fall back to the
74+
# absolute path (e.g. --ffmpeg-dir pointing outside the repo on CI).
75+
try:
76+
return str(p.relative_to(REPO_DIR))
77+
except ValueError:
78+
return str(p)
79+
80+
7281
def copy_file(src: Path, dst: Path) -> None:
7382
if not src.exists():
7483
print(f"WARNING: {src} missing - skipping {dst.name}")
7584
return
7685
dst.parent.mkdir(parents=True, exist_ok=True)
7786
shutil.copy2(src, dst)
78-
print(f" {src.relative_to(REPO_DIR)} -> {dst.relative_to(REPO_DIR)}")
87+
print(f" {_rel(src)} -> {_rel(dst)}")
7988

8089

8190
def stage_ffmpeg(ffmpeg_dir: Path | None) -> None:

0 commit comments

Comments
 (0)