2020-01-26 00:04:29 +01:00
|
|
|
# Import this class to load the standard HLDS definitions
|
|
|
|
|
|
|
|
from os import path
|
2020-01-26 15:09:22 +01:00
|
|
|
from typing import List
|
2020-02-25 17:51:53 +01:00
|
|
|
import subprocess
|
2020-01-26 01:33:08 +01:00
|
|
|
from .parser import parse_all_directory
|
2020-01-26 15:09:22 +01:00
|
|
|
from .models import Location
|
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
|
2020-01-26 01:45:20 +01:00
|
|
|
DATA_DIR = path.join(path.dirname(__file__), "..", "..", "data")
|
2020-01-26 00:04:29 +01:00
|
|
|
|
2020-01-26 15:09:22 +01:00
|
|
|
location_definitions: List[Location] = parse_all_directory(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
|
|
|
|
|
|
|
proc = subprocess.run(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE, check=True)
|
2020-06-22 18:43:52 +02:00
|
|
|
location_definition_version = proc.stdout.decode().strip()
|