def default_env(env=None, config=None, login=True): """Constructs a default xonsh environment.""" # in order of increasing precedence ctx = dict(BASE_ENV) ctx.update(os.environ) ctx["PWD"] = _get_cwd() or "" # other shells' PROMPT definitions generally don't work in XONSH: try: del ctx["PROMPT"] except KeyError: pass if login: conf = load_static_config(ctx, config=config) foreign_env = load_foreign_envs(shells=conf.get("foreign_shells", ()), issue_warning=False) if ON_WINDOWS: windows_foreign_env_fixes(foreign_env) foreign_env_fixes(foreign_env) ctx.update(foreign_env) # Do static config environment last, to allow user to override any of # our environment choices ctx.update(conf.get("env", ())) # finalize env if env is not None: ctx.update(env) return ctx
def default_env(env=None, config=None, login=True): """Constructs a default xonsh environment.""" # in order of increasing precedence ctx = dict(BASE_ENV) ctx.update(os.environ) ctx['PWD'] = _get_cwd() or '' # other shells' PROMPT definitions generally don't work in XONSH: try: del ctx['PROMPT'] except KeyError: pass if login: conf = load_static_config(ctx, config=config) foreign_env = load_foreign_envs(shells=conf.get('foreign_shells', ()), issue_warning=False) if ON_WINDOWS: windows_foreign_env_fixes(foreign_env) foreign_env_fixes(foreign_env) ctx.update(foreign_env) # Do static config environment last, to allow user to override any of # our environment choices ctx.update(conf.get('env', ())) # finalize env if env is not None: ctx.update(env) return ctx
def default_env(env=None): """Constructs a default xonsh environment.""" # in order of increasing precedence ctx = dict(BASE_ENV) ctx.update(os.environ) conf = load_static_config(ctx) ctx.update(conf.get("env", ())) ctx.update(load_foreign_envs(shells=conf.get("foreign_shells", DEFAULT_SHELLS), issue_warning=False)) if ON_WINDOWS: windows_env_fixes(ctx) # finalize env if env is not None: ctx.update(env) return ctx
def default_env(env=None, config=None): """Constructs a default xonsh environment.""" # in order of increasing precedence ctx = dict(BASE_ENV) ctx.update(os.environ) conf = load_static_config(ctx, config=config) ctx.update(conf.get('env', ())) ctx.update(load_foreign_envs(shells=conf.get('foreign_shells', DEFAULT_SHELLS), issue_warning=False)) if ON_WINDOWS: windows_env_fixes(ctx) # finalize env if env is not None: ctx.update(env) return ctx