pytex/PyTeX/build/versioning/version_info/version_info.py

31 lines
1 KiB
Python

from typing import Optional
from PyTeX.format.git_version_info import GitVersionInfo
from .constants import *
class FileVersionInfo:
def __init__(self, dictionary: dict):
if JSON_MD5_CHECKSUM not in dictionary.keys():
raise NotImplementedError
else:
self._md5_checksum = dictionary[JSON_MD5_CHECKSUM]
self._source_repository_version: Optional[GitVersionInfo] = \
GitVersionInfo(dictionary[JSON_REPOSITORY]) if JSON_REPOSITORY in dictionary.keys() \
else None
self._pytex_repository_version: Optional[GitVersionInfo] = \
GitVersionInfo(dictionary[JSON_PYTEX]) if JSON_PYTEX in dictionary.keys() \
else None
@property
def md5_checksum(self) -> str:
return self._md5_checksum
@property
def source_repository_version(self) -> Optional[GitVersionInfo]:
return self._source_repository_version
@property
def pytex_repository_version(self) -> Optional[GitVersionInfo]:
return self._pytex_repository_version