From a13fdc70e1f573dff52405d1bd248dc1ee3bf264 Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Sat, 27 Aug 2022 03:49:07 +0200 Subject: [PATCH] config: add config.runtime.uid --- config/scheme.py | 7 ++++--- config/state.py | 11 +++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/config/scheme.py b/config/scheme.py index 80f1970..3add208 100644 --- a/config/scheme.py +++ b/config/scheme.py @@ -200,11 +200,12 @@ class Config(DataClass): @munchclass() class RuntimeConfiguration(DataClass): verbose: bool - config_file: Optional[str] - arch: Optional[Arch] no_wrap: bool - script_source_dir: str error_shell: bool + config_file: Optional[str] + script_source_dir: Optional[str] + arch: Optional[Arch] + uid: Optional[int] class ConfigLoadState(DataClass): diff --git a/config/state.py b/config/state.py index 5e64451..cb6f318 100644 --- a/config/state.py +++ b/config/state.py @@ -53,11 +53,12 @@ CONFIG_SECTIONS = list(CONFIG_DEFAULTS.keys()) CONFIG_RUNTIME_DEFAULTS: RuntimeConfiguration = RuntimeConfiguration.fromDict({ 'verbose': False, - 'config_file': None, - 'arch': None, 'no_wrap': False, - 'script_source_dir': os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'error_shell': False, + 'config_file': None, + 'script_source_dir': None, + 'arch': None, + 'uid': None, }) @@ -194,7 +195,9 @@ class ConfigStateHolder: self.file = Config.fromDict(merge_configs(conf_new=file_conf_base, conf_base=CONFIG_DEFAULTS)) self.file_state = ConfigLoadState() self.runtime = RuntimeConfiguration.fromDict(CONFIG_RUNTIME_DEFAULTS | runtime_conf) - self.runtime['arch'] = os.uname().machine + self.runtime.arch = os.uname().machine + self.runtime.script_source_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + self.runtime.uid = os.getuid() self._profile_cache = {} if file_conf_path: self.try_load_file(file_conf_path)