utils: fixes minor typo

Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
This commit is contained in:
Pedro Lamas 2021-12-28 16:06:17 +00:00 committed by Eric Callahan
parent d997fd637a
commit 9d7baa1eb6
2 changed files with 5 additions and 5 deletions

View File

@ -87,7 +87,7 @@ class MoonrakerLoggingHandler(logging.handlers.TimedRotatingFileHandler):
# Parse the git version from the command line. This code
# is borrowed from Klipper.
def retreive_git_version(source_path: str) -> str:
def retrieve_git_version(source_path: str) -> str:
# Obtain version info from "git" program
prog = ('git', '-C', source_path, 'describe', '--always',
'--tags', '--long', '--dirty')
@ -97,13 +97,13 @@ def retreive_git_version(source_path: str) -> str:
retcode = process.wait()
if retcode == 0:
return ver.strip().decode()
raise Exception(f"Failed to retreive git version: {err.decode()}")
raise Exception(f"Failed to retrieve git version: {err.decode()}")
def get_software_version() -> str:
version = "?"
try:
version = retreive_git_version(MOONRAKER_PATH)
version = retrieve_git_version(MOONRAKER_PATH)
except Exception:
vfile = pathlib.Path(os.path.join(
MOONRAKER_PATH, "moonraker/.version"))

View File

@ -17,7 +17,7 @@ from typing import Dict, Any, List, Set, Optional
MOONRAKER_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), ".."))
sys.path.append(os.path.join(MOONRAKER_PATH, "moonraker"))
from utils import hash_directory, retreive_git_version # noqa:E402
from utils import hash_directory, retrieve_git_version # noqa:E402
# Dirs and exts to ignore when calculating the repo hash
IGNORE_DIRS = ["out", "lib", "test", "docs", "__pycache__"]
@ -242,7 +242,7 @@ def generate_version_info(path: str,
owner_repo = OWNER_REPOS[source_dir]
curtime = int(time.time())
date_str = time.strftime("%Y%m%d", time.gmtime(curtime))
version = retreive_git_version(path)
version = retrieve_git_version(path)
if release_tag is None:
release_tag = version.split('-')[0]
source_hash = hash_directory(path, IGNORE_EXTS, IGNORE_DIRS)