Package kiwix-desktop on Windows

This commit is contained in:
Matthieu Gautier
2024-08-22 16:25:01 +02:00
parent 1d93c35c50
commit 45ad41724c
3 changed files with 87 additions and 4 deletions

View File

@ -44,7 +44,11 @@ TOOLCHAIN_DIR = BASE_DIR / "TOOLCHAINS"
INSTALL_DIR = BASE_DIR / "INSTALL"
default_tmp_dir = os.getenv("TEMP") if platform.system() == "Windows" else "/tmp"
TMP_DIR = Path(os.getenv("TMP_DIR", default_tmp_dir))
KBUILD_SOURCE_DIR = HOME / "kiwix-build"
if platform.system() == "Windows":
KBUILD_SOURCE_DIR = Path(_environ["GITHUB_WORKSPACE"])
else:
KBUILD_SOURCE_DIR = HOME / "kiwix-build"
_ref = _environ.get("GITHUB_REF", "").split("/")[-1]
MAKE_RELEASE = re.fullmatch(r"r_[0-9]+", _ref) is not None
@ -480,11 +484,27 @@ def create_desktop_image(make_release):
build_path = BASE_DIR / "org.kiwix.desktop.flatpak"
app_name = "org.kiwix.desktop.{}.flatpak".format(postfix)
print_message("archive is {}", build_path)
elif platform.system() == "Windows":
archive_basename = "Kiwix-{}-win-amd64".format(postfix)
working_dir = INSTALL_DIR / archive_basename
build_path = working_dir.with_suffix(".zip")
app_name = build_path.name
command = [
"python",
KBUILD_SOURCE_DIR / "scripts" / "package_kiwix-desktop_windows.py",
str(INSTALL_DIR),
str(working_dir),
str(build_path),
]
if make_release:
command += ["-s"]
print_message("Package archive of kiwix-desktop")
subprocess.check_call(command, cwd=str(HOME))
else:
build_path = HOME / "Kiwix-{}-x86_64.AppImage".format(postfix)
app_name = "kiwix-desktop_x86_64_{}.appimage".format(postfix)
command = [
"kiwix-build/scripts/create_kiwix-desktop_appImage.sh",
KBUILD_SOURCE_DIR / "scripts" / "create_kiwix-desktop_appImage.sh",
str(INSTALL_DIR),
str(src_dir),
str(HOME / "AppDir"),