utils: fixes minor typo
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
This commit is contained in:
parent
d997fd637a
commit
9d7baa1eb6
|
@ -87,7 +87,7 @@ class MoonrakerLoggingHandler(logging.handlers.TimedRotatingFileHandler):
|
||||||
|
|
||||||
# Parse the git version from the command line. This code
|
# Parse the git version from the command line. This code
|
||||||
# is borrowed from Klipper.
|
# 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
|
# Obtain version info from "git" program
|
||||||
prog = ('git', '-C', source_path, 'describe', '--always',
|
prog = ('git', '-C', source_path, 'describe', '--always',
|
||||||
'--tags', '--long', '--dirty')
|
'--tags', '--long', '--dirty')
|
||||||
|
@ -97,13 +97,13 @@ def retreive_git_version(source_path: str) -> str:
|
||||||
retcode = process.wait()
|
retcode = process.wait()
|
||||||
if retcode == 0:
|
if retcode == 0:
|
||||||
return ver.strip().decode()
|
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:
|
def get_software_version() -> str:
|
||||||
version = "?"
|
version = "?"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
version = retreive_git_version(MOONRAKER_PATH)
|
version = retrieve_git_version(MOONRAKER_PATH)
|
||||||
except Exception:
|
except Exception:
|
||||||
vfile = pathlib.Path(os.path.join(
|
vfile = pathlib.Path(os.path.join(
|
||||||
MOONRAKER_PATH, "moonraker/.version"))
|
MOONRAKER_PATH, "moonraker/.version"))
|
||||||
|
|
|
@ -17,7 +17,7 @@ from typing import Dict, Any, List, Set, Optional
|
||||||
MOONRAKER_PATH = os.path.abspath(
|
MOONRAKER_PATH = os.path.abspath(
|
||||||
os.path.join(os.path.dirname(__file__), ".."))
|
os.path.join(os.path.dirname(__file__), ".."))
|
||||||
sys.path.append(os.path.join(MOONRAKER_PATH, "moonraker"))
|
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
|
# Dirs and exts to ignore when calculating the repo hash
|
||||||
IGNORE_DIRS = ["out", "lib", "test", "docs", "__pycache__"]
|
IGNORE_DIRS = ["out", "lib", "test", "docs", "__pycache__"]
|
||||||
|
@ -242,7 +242,7 @@ def generate_version_info(path: str,
|
||||||
owner_repo = OWNER_REPOS[source_dir]
|
owner_repo = OWNER_REPOS[source_dir]
|
||||||
curtime = int(time.time())
|
curtime = int(time.time())
|
||||||
date_str = time.strftime("%Y%m%d", time.gmtime(curtime))
|
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:
|
if release_tag is None:
|
||||||
release_tag = version.split('-')[0]
|
release_tag = version.split('-')[0]
|
||||||
source_hash = hash_directory(path, IGNORE_EXTS, IGNORE_DIRS)
|
source_hash = hash_directory(path, IGNORE_EXTS, IGNORE_DIRS)
|
||||||
|
|
Loading…
Reference in New Issue