mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-16 11:58:09 +00:00
32 lines
735 B
Python
32 lines
735 B
Python
#!/usr/bin/env python
|
|
#
|
|
# Copyright (c) Microsoft Corporation.
|
|
# Licensed under the MIT License.
|
|
|
|
import os
|
|
from typing import Dict
|
|
|
|
from memoization import cached
|
|
from onefuzztypes.responses import Version
|
|
|
|
from .__version__ import __version__
|
|
|
|
|
|
@cached
|
|
def read_local_file(filename: str) -> str:
|
|
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), filename)
|
|
if os.path.exists(path):
|
|
with open(path, "r") as handle:
|
|
return handle.read().strip()
|
|
else:
|
|
return "UNKNOWN"
|
|
|
|
|
|
def versions() -> Dict[str, Version]:
|
|
entry = Version(
|
|
git=read_local_file("git.version"),
|
|
build=read_local_file("build.id"),
|
|
version=__version__,
|
|
)
|
|
return {"onefuzz": entry}
|