Add Back Compatibility Shims for 6.2.0

This commit is contained in:
David Sangrey committed 2026-06-04 23:00:36 -04:00
1 parent d045a8ba66
commit 60fb4a10dc
4 files changed
+69 -1

No files matched your search

+21
View File
@@ -364,6 +364,27 @@ def get_plugin_logger(plugin_name: str, loglevel: int = _default_loglevel) -> Lo
# munged into InterceptHandler. Logger/Loguru both are handling this complex logic
# without sys._getframe() calls.
class EDMCContextFilter(logging.Filter):
"""
Legacy compatibility shim.
EDMC now intercepts standard logging globally via Loguru,
making manual context filtering obsolete.
"""
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
warnings.warn(
"EDMCContextFilter is deprecated and no longer performs log enrichment. "
"It will be completely removed in a future major version release.",
DeprecationWarning,
stacklevel=2
)
def filter(self, record: logging.LogRecord) -> bool:
"""Establish Compatibilty Shim."""
# Pass everything through cleanly without altering the record
return True
def get_main_logger(sublogger_name: str = '') -> LoggerMixin:
"""Return the correct logger for how the program is being run."""
if not os.getenv("EDMC_NO_UI"):
+1 -1
View File
@@ -56,7 +56,7 @@ appcmdname = "EDMC"
# <https://semver.org/#semantic-versioning-specification-semver>
# Major.Minor.Patch(-prerelease)(+buildmetadata)
# NB: Do *not* import this, use the functions appversion() and appversion_nobuild()
_static_appversion = "6.1.3-beta3"
_static_appversion = "6.2.0-alpha0"
_cached_version: semantic_version.Version | None = None
copyright = "© 2015-2019 Jonathan Harris, 2020-2026 EDCD"
IS_FROZEN = getattr(sys, 'frozen', False)
+15
View File
@@ -11,6 +11,7 @@ import json
import sys
import time
import tkinter as tk
import warnings
from datetime import datetime
from pathlib import Path
from typing import Any
@@ -159,6 +160,20 @@ class Dashboard(FileSystemEventHandler):
except Exception:
logger.exception('Processing Status.json')
def poll(self, first_time: bool = False) -> None:
"""
Legacy compatibility shim for backwards compatibility with plugins.
Status.json is now handled entirely via filesystem event observers.
"""
warnings.warn(
"Dashboard.poll() is deprecated as EDMC now leverages unified Watchdog observers. "
"This method is a no-op and will be removed in a future major version.",
DeprecationWarning,
stacklevel=2
)
# Safely run process once just in case the plugin was using it to force a refresh
self.process()
# singleton
dashboard = Dashboard()
+32
View File
@@ -0,0 +1,32 @@
"""
text.py - Dealing with Text and Bytes.
Copyright (c) EDCD, All Rights Reserved
Licensed under the GNU General Public License v2 or later.
See LICENSE file.
"""
from __future__ import annotations
from gzip import compress
from warnings import deprecated
__all__ = ['gzip']
@deprecated("text.gzip is deprecated and will be removed in a later version!")
def gzip(data: str | bytes, max_size: int = 512, encoding='utf-8') -> tuple[bytes, bool]:
"""
Compress the given data if the max size is greater than specified.
The default was chosen somewhat arbitrarily, see eddn.py for some more careful
work towards keeping the data almost always compressed
:param data: The data to compress
:param max_size: The max size of data, in bytes, defaults to 512
:param encoding: The encoding to use if data is a str, defaults to 'utf-8'
:return: the payload to send, and a bool indicating compression state
"""
if isinstance(data, str):
data = data.encode(encoding=encoding)
if len(data) <= max_size:
return data, False
return compress(data), True