mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
really make rc files be run in __xonsh_ctx__ directly
This commit is contained in:
parent
a46e0569c2
commit
a470cdc067
3 changed files with 5 additions and 4 deletions
|
@ -633,7 +633,6 @@ def load_builtins(execer=None, config=None, login=False, ctx=None):
|
|||
# private built-ins
|
||||
builtins.__xonsh_config__ = {}
|
||||
builtins.__xonsh_env__ = ENV = Env(default_env(config=config, login=login))
|
||||
builtins.__xonsh_ctx__ = {} if ctx is None else ctx
|
||||
builtins.__xonsh_help__ = helper
|
||||
builtins.__xonsh_superhelp__ = superhelper
|
||||
builtins.__xonsh_regexpath__ = regexpath
|
||||
|
|
|
@ -173,6 +173,7 @@ def premain(argv=None):
|
|||
"""Setup for main xonsh entry point, returns parsed arguments."""
|
||||
if setproctitle is not None:
|
||||
setproctitle(' '.join(['xonsh'] + sys.argv[1:]))
|
||||
builtins.__xonsh_ctx__ = {}
|
||||
args, other = parser.parse_known_args(argv)
|
||||
if args.file is not None:
|
||||
real_argv = (argv or sys.argv)
|
||||
|
@ -190,7 +191,8 @@ def premain(argv=None):
|
|||
'completer': False,
|
||||
'login': False,
|
||||
'scriptcache': args.scriptcache,
|
||||
'cacheall': args.cacheall}
|
||||
'cacheall': args.cacheall,
|
||||
'ctx': builtins.__xonsh_ctx__}
|
||||
if args.login:
|
||||
shell_kwargs['login'] = True
|
||||
if args.config_path is None:
|
||||
|
|
|
@ -83,7 +83,7 @@ class Shell(object):
|
|||
self.execer = Execer(config=config, login=self.login, xonsh_ctx=self.ctx)
|
||||
self.execer.scriptcache = scriptcache
|
||||
self.execer.cacheall = cacheall
|
||||
if ctx is None and (self.stype != 'none' or self.login):
|
||||
if self.stype != 'none' or self.login:
|
||||
# load xontribs from config file
|
||||
names = builtins.__xonsh_config__.get('xontribs', ())
|
||||
for name in names:
|
||||
|
@ -91,5 +91,5 @@ class Shell(object):
|
|||
# load run control files
|
||||
env = builtins.__xonsh_env__
|
||||
rc = env.get('XONSHRC') if rc is None else rc
|
||||
self.ctx.update(xonshrc_context(rcfiles=rc, execer=self.execer))
|
||||
self.ctx.update(xonshrc_context(rcfiles=rc, execer=self.execer, initial=self.ctx))
|
||||
self.ctx['__name__'] = '__main__'
|
||||
|
|
Loading…
Add table
Reference in a new issue