Skip to content

Commit

Permalink
Fix a regression that broke kitten update-self
Browse files Browse the repository at this point in the history
Fixes #6729
  • Loading branch information
kovidgoyal committed Oct 18, 2023
1 parent 0300a35 commit a9b412b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 3 additions & 3 deletions gen/go_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,11 @@ def generate_constants() -> str:
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}`
Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]}'
Expand Down
4 changes: 2 additions & 2 deletions tools/cmd/update_self/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ package update_self

import (
"fmt"
"kitty"
"os"
"path/filepath"
"runtime"

"kitty"
"kitty/tools/cli"
"kitty/tools/tty"
"kitty/tools/tui"
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions tools/tui/download_with_progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit a9b412b

Please sign in to comment.