Add KITTY_VCS_REV for release builds as well

This commit is contained in:
Kovid Goyal 2023-02-28 19:41:28 +05:30
parent 5b46d990a2
commit cd8bb462c3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 10 additions and 3 deletions

View File

@ -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']

View File

@ -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

View File

@ -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')

View File

@ -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,
)