Files
deskflow/scripts/package.py
Nick Bolton bec38ab47b Re-implement packaging for GitHub workflows (Windows) (#7360)
* Add new version env vars to example

* Remove test file

* Move CMake packaging to separate module and configure OpenSSL path for Windows

* Make VS Code CMake build task default

* Generate Microsoft-friendly 4-digit version number

* Update macOS bundle .plist with build year variable

* Use correct OpenSSL path and fixed various MSI variables

* Use correct rest/dist dir for MSI

* Add version .rc file for Windows

* Use macro instead of over-complicated version query command

* Made cmd_utils more secure by defaulting to no-shell and no-print

* Add certificate management module

* Implement packaging script on Windows

* Refactor Mac packaging script to use new cmd_utils args and new cert module

* Update ChangeLog

* Change PFX env vars and add to CI

* Use import as instead of from lib to solve resolve issue

* Allow custom certificate extensions

* Check for package version when using gdrive

* Make version number required

* Add missing shell

* Add missing gdrive value in test

* Find OpenSSL dir based on openssl binary

* Only use first OpenSSL entry

* More verbose logging

* Improve logging

* Only use env var if not empty

* Fixed wrong var

* Fixed macOS GitHub artefact name

* Change filename format to match new convention
2024-06-28 09:35:18 +00:00

58 lines
1.2 KiB
Python
Executable File

#!/usr/bin/env python3
import platform
import lib.env as env
env_file = ".env"
package_filename_product = "synergy"
def main():
# important: load venv before loading modules that install deps.
env.ensure_in_venv(__file__)
env.ensure_module("dotenv", "python-dotenv")
from dotenv import load_dotenv # type: ignore
load_dotenv(dotenv_path=env_file)
version = env.get_app_version()
filename_base = get_filename_base(version)
print(f"Package filename base: {filename_base}")
if env.is_windows():
windows_package(filename_base)
elif env.is_mac():
mac_package(filename_base)
elif env.is_linux():
linux_package(filename_base)
else:
raise RuntimeError(f"Unsupported platform: {env.get_os()}")
def get_filename_base(version):
os = env.get_os()
machine = platform.machine().lower()
return f"{package_filename_product}-{os}-{machine}-{version}"
def windows_package(filename_base):
import lib.windows as windows
windows.package(filename_base)
def mac_package(filename_base):
import lib.mac as mac
mac.package(filename_base)
def linux_package(filename_base):
"""TODO: Linux packaging"""
pass
if __name__ == "__main__":
main()