haldis/app/hlds/definitions.py

22 lines
686 B
Python
Raw Normal View History

# Import this class to load the standard HLDS definitions
from os import path
from typing import List
2020-02-25 17:51:53 +01:00
import subprocess
from .parser import parse_all_directory
from .models import Location
2020-02-25 17:51:53 +01:00
__all__ = ["location_definitions", "location_definition_version"]
# pylint: disable=invalid-name
# TODO Use proper way to get resources, see https://stackoverflow.com/a/10935674
DATA_DIR = path.join(path.dirname(__file__), "..", "..", "data")
location_definitions: List[Location] = parse_all_directory(DATA_DIR)
location_definitions.sort(key=lambda l: l.name)
2020-02-25 17:51:53 +01:00
proc = subprocess.run(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE, check=True)
location_definition_version = proc.stdout