Update modules/launch_utils.py

Co-authored-by: Aarni Koskela <akx@iki.fi>
This commit is contained in:
w-e-w 2023-06-03 13:07:07 +09:00 committed by GitHub
parent 0dd6bca4f1
commit d1bfc86ffc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -68,8 +68,12 @@ def git_tag():
try: try:
return subprocess.check_output([git, "describe", "--tags"], shell=False, encoding='utf8').strip() return subprocess.check_output([git, "describe", "--tags"], shell=False, encoding='utf8').strip()
except Exception: except Exception:
with open(os.path.dirname(os.path.abspath(__file__)) + "/../CHANGELOG.md") as file: try:
return next((line.strip() for line in file if line.strip()), "<none>") 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()), "<none>")
except Exception:
return "<none>"
def run(command, desc=None, errdesc=None, custom_env=None, live: bool = default_command_live) -> str: def run(command, desc=None, errdesc=None, custom_env=None, live: bool = default_command_live) -> str: