From 3e05f537ae0bf628806f4655b98e26774cfdbc55 Mon Sep 17 00:00:00 2001 From: Ttibsi Date: Wed, 28 Jan 2026 09:04:29 +0000 Subject: [PATCH 1/3] Update run script to query rawterm version and write to build --- run.py | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/run.py b/run.py index 3812b82..f357dd3 100755 --- a/run.py +++ b/run.py @@ -32,6 +32,20 @@ def loc() -> int: ) +def restore_rawterm_to_main() -> None: + print("[LOG] Restoring rawterm to main branch") + with open("src/CMakeLists.txt", "r") as f: + lines = f.readlines() + + for idx, line in enumerate(lines): + if "set(RAWTERM_GIT_TAG" in line and "main" not in line: + lines[idx] = "set(RAWTERM_GIT_TAG \"main\")\n" + break + + with open("src/CMakeLists.txt", "w") as f: + f.writelines(lines) + + def clean() -> int: print("Removing build directory") shutil.rmtree("build", ignore_errors=True) @@ -55,9 +69,10 @@ def clean() -> int: for file in files: if os.path.isfile(file): - print(f"Removing {file}") + print(f"[LOG] Removing {file}") os.remove(file) + restore_rawterm_to_main() return 0 @@ -66,7 +81,7 @@ def create_read_only_file() -> None: if os.path.exists(file_name): return - print("Creating readonly file...") + print("[LOG] Creating readonly file...") with open(file_name, "w") as f: f.write("This is a read-only file\n") f.write("We have some more text here") @@ -115,10 +130,10 @@ def create_symlink() -> None: if platform.machine() == "x86_64": src += "_x86_64" - print("Creating symlink (x86_64)...") + print("[LOG] Creating symlink (x86_64)...") elif platform.machine() == "aarch64": src += "_aarch64" - print("Creating symlink (aarch64)...") + print("[LOG] Creating symlink (aarch64)...") else: raise OSError("Architecture not found") @@ -157,12 +172,44 @@ def test(testname: str | None, asan: bool) -> int: ) +def get_rawterm_version() -> str: + cmd = [ + "git", + "ls-remote", + "--tags", + "--sort=v:refname", + "git@github.com:Ttibsi/rawterm", + ] + + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + + last_version_str = result.stdout.strip().splitlines()[-1] + version_tag = last_version_str.split("/")[-1] + return version_tag.strip() + + +def write_rawterm_version(tag: str) -> None: + print(f"[LOG] rawterm version: {tag}") + with open("src/CMakeLists.txt", "r") as f: + lines = f.readlines() + + for idx, line in enumerate(lines): + if "set(RAWTERM_GIT_TAG" in line and "main" in line: + lines[idx] = line.replace("main", tag) + + with open("src/CMakeLists.txt", "w") as f: + f.writelines(lines) + + def build(release: bool = False) -> int: ret: int = 0 cmd: str = "cmake -G Ninja -S . -B build" if release: cmd += " -DRELEASE=true" + version_tag = get_rawterm_version() + write_rawterm_version(version_tag) + ret = run_shell_cmd(cmd) if ret: return ret @@ -216,7 +263,8 @@ def main(argv: Sequence[str] | None = None) -> int: else: ret = build(args.release) - print(f"Elapsed time: {round(timeit.default_timer() - start, 2)} Seconds") + elapsed_time = round(timeit.default_timer() - start, 2) + print(f"[LOG] Elapsed time: {elapsed_time} Seconds") return ret From 160994023fa4ce6f610b211b5e5ad456dd995edc Mon Sep 17 00:00:00 2001 From: Ttibsi Date: Wed, 28 Jan 2026 09:05:00 +0000 Subject: [PATCH 2/3] handle inserting rawterm version into version command --- src/CMakeLists.txt | 3 ++- src/version.h.in | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a158cba..e22368e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,10 +2,11 @@ include_directories(${PROJECT_SOURCE_DIR}/src) include_directories(${PROJECT_SOURCE_DIR}/include) include(FetchContent) +set(RAWTERM_GIT_TAG "main") fetchcontent_declare( rawterm GIT_REPOSITORY https://github.com/ttibsi/rawterm - GIT_TAG main + GIT_TAG ${RAWTERM_GIT_TAG} ) fetchcontent_makeavailable(rawterm) diff --git a/src/version.h.in b/src/version.h.in index b1dbc58..fe3a860 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -3,10 +3,11 @@ #include -[[nodiscard]] constexpr inline std::string_view version() noexcept { +[[nodiscard]] constexpr std::string_view version() noexcept { return "Iris version: " "@GIT_VERSION@" "\n" "Compiled on date: " "@COMPILE_DATE@" "\n" - "Build type: " "@BUILD_MODE@"; + "Build type: " "@BUILD_MODE@" "\n" + "Rawterm version: " "@RAWTERM_GIT_TAG@" "\n"; } #endif // VERSION_H From 95bf79429d0f1b79fa47457bfd446a2cee08e79b Mon Sep 17 00:00:00 2001 From: Ttibsi Date: Wed, 28 Jan 2026 09:11:16 +0000 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index af6393f..087e6d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ moves back that amount of space * Iris now handles horizontal scrolling when a line is longer than the screen * Allow for specifying file to save to from command bar * `e` key now moves cursor to end of the current word +* Add the version of the `rawterm` library used to the `--version` command +when making a release build * Resolved issue with iris crashing after opening an existing file with 0 bytes * Resolved issue where filename isn't centered in the status bar