2020-01-26 00:04:29 +01:00
|
|
|
# Import this class to load the standard HLDS definitions
|
2022-04-19 22:03:00 +02:00
|
|
|
import subprocess
|
2023-04-19 21:18:44 +02:00
|
|
|
from pathlib import Path
|
2020-01-26 15:09:22 +01:00
|
|
|
from typing import List
|
2020-01-26 00:04:29 +01:00
|
|
|
|
2022-04-19 22:03:00 +02:00
|
|
|
from .models import Location
|
|
|
|
from .parser import parse_all_directory
|
2020-01-26 00:04:29 +01:00
|
|
|
|
2020-02-25 17:51:53 +01:00
|
|
|
__all__ = ["location_definitions", "location_definition_version"]
|
|
|
|
|
|
|
|
# pylint: disable=invalid-name
|
2020-01-26 00:04:29 +01:00
|
|
|
|
|
|
|
# TODO Use proper way to get resources, see https://stackoverflow.com/a/10935674
|
2023-04-19 21:18:44 +02:00
|
|
|
ROOT_DIR = Path(__file__).parent.parent.parent
|
|
|
|
DATA_DIR = ROOT_DIR / "menus"
|
2020-01-26 00:04:29 +01:00
|
|
|
|
2023-04-19 21:18:44 +02:00
|
|
|
location_definitions: List[Location] = parse_all_directory(str(DATA_DIR))
|
2020-01-26 16:02:03 +01:00
|
|
|
location_definitions.sort(key=lambda l: l.name)
|
2020-02-25 17:51:53 +01:00
|
|
|
|
2023-04-19 21:18:44 +02:00
|
|
|
proc = subprocess.run(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE, cwd=str(ROOT_DIR), check=True)
|
2020-06-22 18:43:52 +02:00
|
|
|
location_definition_version = proc.stdout.decode().strip()
|