-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add commit revision to beta branch version display (#7768) #7820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
The current hash in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NB: When you install packages into a Python project, you should always use a virtual environment for that project, if you haven't done so already. PyCharm can create one for you (Settings > Project: Path of Building > Python Interpreter
Add Interpreter > Add Local Interpreter > Virtualenv Environment).
import xml.etree.ElementTree as Et | ||
import subprocess |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import xml.etree.ElementTree as Et | |
import subprocess | |
import subprocess | |
import xml.etree.ElementTree as Et |
Sort imports in alphabetical order. You can use isort
(pip install isort
) to automatically sort imports.
@@ -49,6 +50,8 @@ def _alphanumeric(key: str) -> list[int | str]: | |||
for character in re.split(alphanumeric_pattern, key) | |||
] | |||
|
|||
def _get_latest_commit_hash_short() -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def _get_latest_commit_hash_short() -> str: | |
def _latest_commit_hash_short() -> str: |
Usually, you leave out get
/set
in Python functions or method names.
@@ -49,6 +50,8 @@ def _alphanumeric(key: str) -> list[int | str]: | |||
for character in re.split(alphanumeric_pattern, key) | |||
] | |||
|
|||
def _get_latest_commit_hash_short() -> str: | |||
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip() | |
return subprocess.run( | |
["git", "rev-parse", "--short", "HEAD"], | |
check=True, | |
stdout=subprocess.PIPE, | |
encoding="ascii", | |
).stdout.strip() |
All of the API surface of subprocess
is soft deprecated except subprocess.run
and subprocess.Popen
.
You can use subprocess.run
to achieve the same result. You can use black
(pip install black
) to automatically format the code like suggested. The black
style prefers double quotes over single quotes.
@@ -78,6 +81,7 @@ def create_manifest(version: str | None = None, replace: bool = False) -> None: | |||
logging.critical(f"Manifest configuration file not found in path '{base_path}'") | |||
return | |||
|
|||
versions = {"number":new_version, "hash":_get_latest_commit_hash_short()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
versions = {"number":new_version, "hash":_get_latest_commit_hash_short()} | |
versions = {"number": new_version, "hash": _latest_commit_hash_short()} |
Changes made by black
.
Fixes #7768 .
Description of the problem being solved:
Added logic to
update_manifest.py
to also store the latest commit hash (short version) in the manifest.xml file.This is then read in in
Launch.lua
and used inMain.lua
when the branch is "beta" to display the Rev/Hash on the lower right.Steps taken to verify a working solution:
Link to a build that showcases this PR: any build on the beta branch
Before screenshot:
After screenshot:
Additional Notes