ignore warnings in releases ()

pull/3097/head dev-build-kaalleen-lettering-font-description
Kaalleen 2024-07-18 18:59:00 +02:00 zatwierdzone przez GitHub
rodzic eadeadb9a6
commit c089a5ed0c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
2 zmienionych plików z 20 dodań i 5 usunięć

Wyświetl plik

@ -124,6 +124,10 @@ debug_logging.startup_info(logger, SCRIPTDIR, running_as_frozen, running_from_in
# we need to import only after possible modification of sys.path, we disable here flake8 E402
from lib import extensions # noqa: E402 # import all supported extensions of institch
# TODO: if we run this earlier the warnings ignore filter for releases will not work properly
if running_as_frozen and not debug_logging.frozen_debug_active():
debug_logging.disable_warnings()
parser = ArgumentParser()
parser.add_argument("--extension")
my_args, remaining_args = parser.parse_known_args()

Wyświetl plik

@ -100,10 +100,9 @@ def activate_logging(running_as_frozen: bool, ini: dict, SCRIPTDIR: Path):
# - PYTHONWARNINGS, -W - warnings action controlled by python
# actions: 'error', 'ignore', 'always', 'default', 'module', 'once'
def activate_for_frozen():
loglevel = os.environ.get('INKSTITCH_LOGLEVEL') # read log level from environment variable or None
docpath = os.environ.get('DOCUMENT_PATH') # read document path from environment variable (set by inkscape) or None
if docpath is not None and loglevel is not None and loglevel.upper() in ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']:
if frozen_debug_active():
loglevel = os.environ.get('INKSTITCH_LOGLEVEL') # read log level from environment variable or None
docpath = os.environ.get('DOCUMENT_PATH') # read document path from environment variable (set by inkscape) or None
# The end user enabled logging and warnings are redirected to the input_svg.inkstitch.log file.
@ -122,7 +121,19 @@ def activate_for_frozen():
logging.captureWarnings(True) # capture all warnings to log file with level WARNING
else:
logging.disable() # globally disable all logging of all loggers
warnings.simplefilter('ignore') # ignore all warnings
disable_warnings()
def frozen_debug_active():
loglevel = os.environ.get('INKSTITCH_LOGLEVEL') # read log level from environment variable or None
docpath = os.environ.get('DOCUMENT_PATH') # read document path from environment variable (set by inkscape) or None
if docpath is not None and loglevel is not None and loglevel.upper() in ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']:
return True
return False
def disable_warnings():
warnings.simplefilter('ignore') # ignore all warnings
# in development mode we want to use configuration from some LOGGING.toml file