From 224e00650d2f395349cd7d9ec91b0469dfe875e3 Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Mon, 27 May 2024 18:37:23 +0800 Subject: [PATCH 1/3] fix(cli): respect rich console markup in user confirmation prompts Fixes: #146 --- ruyi/cli/user_input.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ruyi/cli/user_input.py b/ruyi/cli/user_input.py index 522383c..5e1caf4 100644 --- a/ruyi/cli/user_input.py +++ b/ruyi/cli/user_input.py @@ -8,7 +8,8 @@ def ask_for_yesno_confirmation(prompt: str, default: bool = False) -> bool: while True: try: - user_input = input(f"{prompt} {choices_help} ") + log.stdout(f"{prompt} {choices_help} ", end='') + user_input = input() except EOFError: yesno = "YES" if default else "NO" log.W(f"EOF while reading user input, assuming the default choice {yesno}") From 78371db115107f1198143692f1d21e97a3d2f129 Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Mon, 27 May 2024 19:02:15 +0800 Subject: [PATCH 2/3] fix: fix wrong xdg_basedir implementation & app data dir checking Fixes: 9700e3610b6f ("refactor: re-implement the XDG Base Directory spec ourselves") --- ruyi/config/__init__.py | 2 +- ruyi/utils/xdg_basedir.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ruyi/config/__init__.py b/ruyi/config/__init__.py index 4fff82a..757fd89 100644 --- a/ruyi/config/__init__.py +++ b/ruyi/config/__init__.py @@ -123,7 +123,7 @@ def global_blob_install_root(self, slug: str) -> str: def lookup_binary_install_dir(self, host: str, slug: str) -> PathLike[Any] | None: host_path = get_host_path_fragment_for_binary_install_dir(host) - for data_dir in self._dirs.data_dirs: + for data_dir in self._dirs.app_data_dirs: p = data_dir / "binaries" / host_path / slug if p.exists(): return p diff --git a/ruyi/utils/xdg_basedir.py b/ruyi/utils/xdg_basedir.py index e464406..804cb47 100644 --- a/ruyi/utils/xdg_basedir.py +++ b/ruyi/utils/xdg_basedir.py @@ -69,10 +69,12 @@ def app_state(self) -> pathlib.Path: def app_config_dirs(self) -> Iterable[pathlib.Path]: # from highest precedence to lowest yield self.app_config - yield from self.config_dirs + for p in self.config_dirs: + yield p / self.app_name @property def app_data_dirs(self) -> Iterable[pathlib.Path]: # from highest precedence to lowest yield self.app_data - yield from self.data_dirs + for p in self.data_dirs: + yield p / self.app_name From 51a5950bbf894bbdd7b315f41764920e0b048ba3 Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Mon, 27 May 2024 19:03:24 +0800 Subject: [PATCH 3/3] build: bump self version to 0.11.0-alpha.20240527 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ece3e08..e01e1b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ruyi" -version = "0.11.0-alpha.20240512" +version = "0.11.0-alpha.20240527" description = "Package manager for RuyiSDK" keywords = ["ruyi", "ruyisdk"] # license = { file = "LICENSE-Apache.txt" }