1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Fix zip containing paths

This commit is contained in:
Elias Steurer 2022-11-02 16:29:35 +01:00
parent 141372bee1
commit aeae7ce07e

View File

@ -26,19 +26,22 @@ def clean_build_dir(build_dir):
build_dir.mkdir(parents=True, exist_ok=True) build_dir.mkdir(parents=True, exist_ok=True)
class BuildResult: # Windows example with absolute paths: class BuildResult:
build: Path # [...]/build-x64-windows-release/ # Windows example with absolute paths:
binary: Path # [...]/build-x64-windows-release/bin # [...]/build-x64-windows-release/
build: Path
# [...]/build-x64-windows-release/bin
bin: Path
# [...]/build-x64-windows-release/ScreenPlay-Installer.exe # [...]/build-x64-windows-release/ScreenPlay-Installer.exe
installer: Path installer: Path
# [...]/build-x64-windows-release/ScreenPlay-Installer.zip # [...]/build-x64-windows-release/ScreenPlay-Installer.zip
installer_zip: Path installer_zip: Path
# [...]/build-x64-windows-release/ScreenPlay-0.15.0-RC1-x64-windows-release.zip # [...]/build-x64-windows-release/ScreenPlay-0.15.0-RC1-x64-windows-release.zip
build_zip: Path build_zip: Path
# [...]/build-x64-windows-release/ScreenPlay-0.15.0-RC1-x64-windows-release.txt # [...]/build-x64-windows-release/ScreenPlay-0.15.0-RC1-x64-windows-release.txt :sha256, needed for scoop
build_hash: Path # sha256, needed for scoop build_hash: Path
build_arch: str # x64, arm64, universal # x64, arm64, universal
build_arch: str
class BuildConfig: class BuildConfig:
root_path: str root_path: str
@ -85,7 +88,7 @@ def execute(
build_result = setup_tuple[1] build_result = setup_tuple[1]
build_result.build = Path(build_config.build_folder) build_result.build = Path(build_config.build_folder)
build_result.binary = Path(build_config.bin_dir) build_result.bin = Path(build_config.bin_dir)
# Make sure to always delete everything first. # Make sure to always delete everything first.
# 3rd party tools like the crashreporter create local # 3rd party tools like the crashreporter create local
@ -255,7 +258,7 @@ def build(build_config: BuildConfig, build_result: BuildResult) -> BuildResult:
print(f"\n\n⚙️ CMake build:\n\n") print(f"\n\n⚙️ CMake build:\n\n")
run("cmake --build . --target all", cwd=build_config.build_folder) run("cmake --build . --target all", cwd=build_config.build_folder)
build_result.binary = Path(build_config.bin_dir) build_result.bin = Path(build_config.bin_dir)
return build_result return build_result
@ -377,7 +380,7 @@ def zip(build_config: BuildConfig, build_result: BuildResult) -> BuildResult:
if build_config.create_installer == "ON": if build_config.create_installer == "ON":
build_result.installer_zip = Path(build_result.build).joinpath(build_result.installer.stem + ".zip") build_result.installer_zip = Path(build_result.build).joinpath(build_result.installer.stem + ".zip")
print(f"Create zip from installer: {build_result.installer_zip}") print(f"Create zip from installer: {build_result.installer_zip}")
zipfile.ZipFile(build_result.installer_zip, 'w').write(build_result.installer, build_result.build) zipfile.ZipFile(build_result.installer_zip, 'w').write(build_result.installer, build_result.installer.name)
return build_result return build_result