Fix a regression that broke kitten update-self

Fixes #6729
This commit is contained in:
Kovid Goyal 2023-10-18 19:19:35 +05:30
parent 0300a355d0
commit a9b412baba
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
5 changed files with 19 additions and 16 deletions

View file

@ -64,6 +64,8 @@ Detailed list of changes
- Remote control launch: Fix the ``--copy-env`` option not copying current environment variables (:iss:`6724`)
- Fix a regression that broke ``kitten update-self`` (:iss:`6729`)
0.30.1 [2023-10-05]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -592,11 +592,11 @@ const VersionString string = "{kc.str_version}"
const WebsiteBaseURL string = "{kc.website_base_url}"
const FileTransferCode int = {FILE_TRANSFER_CODE}
const ImagePlaceholderChar rune = {placeholder_char}
const VCSRevision string = ""
const SSHControlMasterTemplate = "{kc.ssh_control_master_template}"
const RC_ENCRYPTION_PROTOCOL_VERSION string = "{kc.RC_ENCRYPTION_PROTOCOL_VERSION}"
const IsFrozenBuild bool = false
const IsStandaloneBuild bool = false
var VCSRevision string = ""
var IsFrozenBuild string = ""
var IsStandaloneBuild string = ""
const HandleTermiosSignals = {Mode.HANDLE_TERMIOS_SIGNALS.value[0]}
const HintsDefaultRegex = `{DEFAULT_REGEX}`
const DefaultTermName = `{Options.term}`

View file

@ -972,15 +972,16 @@ def build_static_kittens(
update_go_generated_files(args, os.path.join(launcher_dir, appname))
cmd = [go, 'build', '-v']
vcs_rev = args.vcs_rev or get_vcs_rev()
ld_flags = [f"-X 'kitty.VCSRevision={vcs_rev}'"]
ld_flags: List[str] = []
binary_data_flags = [f"-X kitty.VCSRevision={vcs_rev}"]
if for_freeze:
ld_flags.append("-X 'kitty.IsFrozenBuild=true'")
binary_data_flags.append("-X kitty.IsFrozenBuild=true")
if for_platform:
ld_flags.append("-X 'kitty.IsStandaloneBuild=true'")
binary_data_flags.append("-X kitty.IsStandaloneBuild=true")
if not args.debug:
ld_flags.append('-s')
ld_flags.append('-w')
cmd += ['-ldflags', ' '.join(ld_flags)]
cmd += ['-ldflags', ' '.join(binary_data_flags + ld_flags)]
dest = os.path.join(destination_dir or launcher_dir, 'kitten')
if for_platform:
dest += f'-{for_platform[0]}-{for_platform[1]}'

View file

@ -4,11 +4,11 @@ package update_self
import (
"fmt"
"kitty"
"os"
"path/filepath"
"runtime"
"kitty"
"kitty/tools/cli"
"kitty/tools/tty"
"kitty/tools/tui"
@ -33,7 +33,7 @@ func update_self(version string) (err error) {
if err != nil {
return err
}
if !kitty.IsStandaloneBuild {
if kitty.IsStandaloneBuild == "" {
return fmt.Errorf("This is not a standalone kitten executable. You must update all of kitty instead.")
}
rv := "v" + version

View file

@ -139,7 +139,14 @@ func DownloadFileWithProgress(destpath, url string, kill_if_signaled bool) (err
}
}
on_timer_tick := func(timer_id loop.IdType) error {
return lp.OnWakeup()
}
lp.OnInitialize = func() (string, error) {
if _, err = lp.AddTimer(rd.spinner.interval, true, on_timer_tick); err != nil {
return "", err
}
go do_download()
lp.QueueWriteString("Downloading: " + url + "\r\n")
return "\r\n", nil
@ -179,13 +186,6 @@ func DownloadFileWithProgress(destpath, url string, kill_if_signaled bool) (err
return nil
}
on_timer_tick := func(timer_id loop.IdType) error {
return lp.OnWakeup()
}
if _, err = lp.AddTimer(rd.spinner.interval, true, on_timer_tick); err != nil {
return
}
err = lp.Run()
dl_data.mutex.Lock()
if dl_data.temp_file_path != "" && !dl_data.download_finished {