2022-02-04 11:39:15 +01:00
|
|
|
from typing import Optional
|
|
|
|
|
2022-02-06 15:09:49 +01:00
|
|
|
from PyTeX.format.git_version_info import GitVersionInfo
|
|
|
|
from .constants import *
|
2022-02-04 11:39:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
class FileVersionInfo:
|
|
|
|
def __init__(self, dictionary: dict):
|
|
|
|
if JSON_MD5_CHECKSUM not in dictionary.keys():
|
2022-02-05 19:05:50 +01:00
|
|
|
raise NotImplementedError
|
2022-02-04 11:39:15 +01:00
|
|
|
else:
|
|
|
|
self._md5_checksum = dictionary[JSON_MD5_CHECKSUM]
|
|
|
|
|
|
|
|
self._source_repository_version: Optional[GitVersionInfo] = \
|
|
|
|
GitVersionInfo(dictionary[JSON_REPOSITORY]) if JSON_REPOSITORY in dictionary.keys() \
|
2022-02-07 18:36:30 +01:00
|
|
|
else None
|
2022-02-04 11:39:15 +01:00
|
|
|
self._pytex_repository_version: Optional[GitVersionInfo] = \
|
|
|
|
GitVersionInfo(dictionary[JSON_PYTEX]) if JSON_PYTEX in dictionary.keys() \
|
2022-02-07 18:36:30 +01:00
|
|
|
else None
|
2022-02-04 11:39:15 +01:00
|
|
|
|
|
|
|
@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
|