Rename min ct required var. Use a minimum version only check instead of full spec
This commit is contained in:
parent
12dd06c558
commit
f977e70562
@ -4,7 +4,7 @@ import logging
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
from packaging.specifiers import InvalidSpecifier, SpecifierSet
|
||||
from packaging.version import InvalidVersion, parse
|
||||
|
||||
if sys.version_info < (3, 10):
|
||||
from importlib_metadata import entry_points
|
||||
@ -33,14 +33,14 @@ def get_talkers(version: str, cache: pathlib.Path) -> dict[str, ComicTalker]:
|
||||
logger.error("Talker ID must be the same as the entry point name")
|
||||
continue
|
||||
try:
|
||||
if version in SpecifierSet(obj.ct_req_spec, prereleases=True):
|
||||
if parse(version) >= parse(obj.comictagger_min_ver):
|
||||
talkers[talker.name] = obj
|
||||
else:
|
||||
logger.error(
|
||||
f"CT required version not met for talker: {talker.name} with specifier: {obj.ct_req_spec}"
|
||||
f"CT minimum required version not met for talker: {talker.name} with version: {obj.comictagger_min_ver}"
|
||||
)
|
||||
except InvalidSpecifier:
|
||||
logger.error(f"Invalid specifier for talker: {talker.name} - specifier: {obj.ct_req_spec}")
|
||||
except InvalidVersion:
|
||||
logger.error(f"Invalid version number for talker: {talker.name} - version: {obj.comictagger_min_ver}")
|
||||
|
||||
except Exception:
|
||||
logger.exception("Failed to load talker: %s", talker.name)
|
||||
|
@ -107,7 +107,7 @@ class ComicTalker:
|
||||
|
||||
name: str = "Example"
|
||||
id: str = "example"
|
||||
ct_req_spec: str = ">=1.6.0a7" # The ComicTagger version required by the talker using PyPA version specifiers
|
||||
comictagger_min_ver: str = "1.6.0a7" # The ComicTagger minimum version required by the talker
|
||||
website: str = "https://example.com"
|
||||
logo_url: str = f"{website}/logo.png"
|
||||
attribution: str = f"Metadata provided by <a href='{website}'>{name}</a>"
|
||||
|
Loading…
Reference in New Issue
Block a user