forked from Mirror/pmbootstrap
We can't totally escape the need for some runtime state defined by args. To make the migration easier, introduce a global "Context" class and move some of the read-only global options there. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
17 lines
442 B
Python
17 lines
442 B
Python
# Copyright 2024 Caleb Connolly
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
from pmb.core.chroot import Chroot, ChrootType
|
|
from pmb.core.context import Context
|
|
|
|
__context: Context
|
|
|
|
def get_context() -> Context:
|
|
"""Get immutable global runtime context."""
|
|
global __context
|
|
|
|
# We must defer this to first call to avoid
|
|
# circular imports.
|
|
if "__context" not in globals():
|
|
__context = Context()
|
|
return __context
|