From 0dd6bca4f1a449b7ad9fa77fab0037aa98d21ced Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Fri, 2 Jun 2023 21:50:08 +0900 Subject: [PATCH 1/3] fallback version info form CHANGELOG.md --- modules/launch_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/launch_utils.py b/modules/launch_utils.py index 6e9bb770..e7dbc5b2 100644 --- a/modules/launch_utils.py +++ b/modules/launch_utils.py @@ -68,7 +68,8 @@ def git_tag(): try: return subprocess.check_output([git, "describe", "--tags"], shell=False, encoding='utf8').strip() except Exception: - return "" + with open(os.path.dirname(os.path.abspath(__file__)) + "/../CHANGELOG.md") as file: + return next((line.strip() for line in file if line.strip()), "") def run(command, desc=None, errdesc=None, custom_env=None, live: bool = default_command_live) -> str: From d1bfc86ffcbe64eea7642ed1292ac89199beb0dc Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Sat, 3 Jun 2023 13:07:07 +0900 Subject: [PATCH 2/3] Update modules/launch_utils.py Co-authored-by: Aarni Koskela --- modules/launch_utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/launch_utils.py b/modules/launch_utils.py index e7dbc5b2..9c3af12f 100644 --- a/modules/launch_utils.py +++ b/modules/launch_utils.py @@ -68,8 +68,12 @@ def git_tag(): try: return subprocess.check_output([git, "describe", "--tags"], shell=False, encoding='utf8').strip() except Exception: - with open(os.path.dirname(os.path.abspath(__file__)) + "/../CHANGELOG.md") as file: - return next((line.strip() for line in file if line.strip()), "") + try: + changelog_md = pathlib.Path(__file__).parent.parent / "CHANGELOG.md" + with changelog_md.open(encoding="utf-8") as file: + return next((line.strip() for line in file if line.strip()), "") + except Exception: + return "" def run(command, desc=None, errdesc=None, custom_env=None, live: bool = default_command_live) -> str: From df5a3cbefe46dbd6b5eb5b6a62e66d5b7378d4ee Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Sat, 3 Jun 2023 13:33:23 +0900 Subject: [PATCH 3/3] fallback version info form CHANGELOG.md --- modules/launch_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/launch_utils.py b/modules/launch_utils.py index 9c3af12f..0c8c4db0 100644 --- a/modules/launch_utils.py +++ b/modules/launch_utils.py @@ -69,7 +69,8 @@ def git_tag(): return subprocess.check_output([git, "describe", "--tags"], shell=False, encoding='utf8').strip() except Exception: try: - changelog_md = pathlib.Path(__file__).parent.parent / "CHANGELOG.md" + from pathlib import Path + changelog_md = Path(__file__).parent.parent / "CHANGELOG.md" with changelog_md.open(encoding="utf-8") as file: return next((line.strip() for line in file if line.strip()), "") except Exception: