Coverage for src / lilbee / _frozen.py: 100%
4 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-06-28 01:01 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-06-28 01:01 +0000
1"""Frozen-build detection shared by package-level code.
3``__main__`` keeps its own copy of this predicate on purpose: the
4multiprocessing/-m child dispatch path there must import nothing from the
5``lilbee`` package (the splash subprocess is deliberately stdlib-only), so it
6cannot import this module. Every other caller imports :func:`is_frozen`.
7"""
9from __future__ import annotations
11import sys
14def is_frozen() -> bool:
15 """True when running from a frozen build.
17 PyInstaller/cx_Freeze set ``sys.frozen``; Nuitka never does but injects a
18 ``__compiled__`` global into every module it compiles. Both must be checked
19 so detection works in the shipped Nuitka onefile binary, not just under
20 PyInstaller.
21 """
22 return bool(sys.__dict__.get("frozen")) or "__compiled__" in globals()