From cd8bb462c3e9e99339c2ea337db21b5cc8af95d2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 28 Feb 2023 19:41:28 +0530 Subject: [PATCH] Add KITTY_VCS_REV for release builds as well --- bypy/init_env.py | 2 ++ glfw/glfw.py | 1 + publish.py | 8 ++++++-- setup.py | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bypy/init_env.py b/bypy/init_env.py index 15e9c5401..bcac3994c 100644 --- a/bypy/init_env.py +++ b/bypy/init_env.py @@ -106,6 +106,8 @@ def build_c_extensions(ext_dir, args): cmd = SETUP_CMD + ['macos-freeze' if ismacos else 'linux-freeze'] if args.dont_strip: cmd.append('--debug') + if args.extra_program_data: + cmd.append(f'--vcs-rev={args.extra_program_data}') dest = kitty_constants['appname'] + ('.app' if ismacos else '') dest = build_frozen_launcher.prefix = os.path.join(ext_dir, dest) cmd += ['--prefix', dest, '--full'] diff --git a/glfw/glfw.py b/glfw/glfw.py index d795cef70..d00b068dc 100755 --- a/glfw/glfw.py +++ b/glfw/glfw.py @@ -69,6 +69,7 @@ class Env: ans.wayland_scanner = self.wayland_scanner ans.wayland_scanner_code = self.wayland_scanner_code ans.wayland_protocols = self.wayland_protocols + ans.vcs_rev = self.vcs_rev return ans diff --git a/publish.py b/publish.py index f840f2682..a6bea43ae 100755 --- a/publish.py +++ b/publish.py @@ -62,6 +62,10 @@ def call(*cmd: str, cwd: Optional[str] = None, echo: bool = False) -> None: def run_build(args: Any) -> None: + import runpy + + m = runpy.run_path('./setup.py', run_name='__publish__') + vcs_rev: str = m['get_vcs_rev']() def run_with_retry(cmd: str) -> None: try: @@ -78,9 +82,9 @@ def run_build(args: Any) -> None: for x in ('64', '32', 'arm64'): prefix = f'python ../bypy linux --arch {x} ' - run_with_retry(prefix + 'program --non-interactive') + run_with_retry(prefix + f'program --non-interactive --extra-program-data "{vcs_rev}"') call(prefix + 'shutdown', echo=True) - run_with_retry('python ../bypy macos program --sign-installers --notarize --non-interactive') + run_with_retry(f'python ../bypy macos program --sign-installers --notarize --non-interactive --extra-program-data "{vcs_rev}"') call('python ../bypy macos shutdown', echo=True) call('./setup.py build-static-binaries') diff --git a/setup.py b/setup.py index 4cd2b50f6..2b9d240e1 100755 --- a/setup.py +++ b/setup.py @@ -838,7 +838,7 @@ def init_env_from_args(args: Options, native_optimizations: bool = False) -> Non args.debug, args.sanitize, native_optimizations, args.link_time_optimization, args.profile, args.egl_library, args.startup_notification_library, args.canberra_library, args.fontconfig_library, args.extra_logging, args.extra_include_dirs, args.ignore_compiler_warnings, - args.build_universal_binary, args.extra_library_dirs, verbose=args.verbose > 0 + args.build_universal_binary, args.extra_library_dirs, verbose=args.verbose > 0, vcs_rev=args.vcs_rev, )