mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 00:14:41 +01:00
xontrib: do not autoload xontribs in `xonsh --no-rc
` mode (#5586)
* no rc no autoload * docs --------- Co-authored-by: a <1@1.1>
This commit is contained in:
parent
10a75ec8ac
commit
86d3f9427e
4 changed files with 31 additions and 3 deletions
|
@ -25,6 +25,7 @@ In addition:
|
|||
* Use ``xonsh --rc snail.xsh`` to run only a certain control file.
|
||||
* Use ``xonsh -i script.xsh`` to run xonsh in interactive mode with loading all possible control files.
|
||||
* Use ``xonsh --rc rc1.xsh rc2.xsh -- script.xsh`` to run scripts with multiple control files.
|
||||
* You can create autoloadable `xontrib <tutorial_xontrib.html#loading-xontribs>`_ as alternative to run control file and reuse it as python package.
|
||||
|
||||
The options set per user override settings in the system-wide control file.
|
||||
|
||||
|
|
23
news/norc_noautoload.rst
Normal file
23
news/norc_noautoload.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Changed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* xontrib: Do not autoload xontribs in ``xonsh --no-rc`` mode.
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -1347,8 +1347,9 @@ class InterpreterSetting(Xettings):
|
|||
class XontribSetting(Xettings):
|
||||
"""Xontrib Settings"""
|
||||
|
||||
XONTRIBS_AUTOLOAD_DISABLED = Var(
|
||||
XONTRIBS_AUTOLOAD_DISABLED = Var.with_default(
|
||||
default=False,
|
||||
type_str="bool",
|
||||
doc="""\
|
||||
Controls auto-loading behaviour of xontrib packages at the startup.
|
||||
* Set this to ``True`` to disable autoloading completely.
|
||||
|
|
|
@ -361,8 +361,10 @@ def start_services(shell_kwargs, args, pre_env=None):
|
|||
scriptcache=shell_kwargs.get("scriptcache", True),
|
||||
cacheall=shell_kwargs.get("cacheall", False),
|
||||
)
|
||||
XSH.load(ctx=ctx, execer=execer, inherit_env=shell_kwargs.get("inherit_env", True))
|
||||
events.on_timingprobe.fire(name="post_execer_init")
|
||||
events.on_timingprobe.fire(name="pre_xonsh_session_load")
|
||||
XSH.load(ctx=ctx, execer=execer, inherit_env=shell_kwargs.get("inherit_env", True))
|
||||
events.on_timingprobe.fire(name="post_xonsh_session_load")
|
||||
|
||||
install_import_hooks(execer)
|
||||
|
||||
|
@ -370,7 +372,8 @@ def start_services(shell_kwargs, args, pre_env=None):
|
|||
for k, v in pre_env.items():
|
||||
env[k] = v
|
||||
|
||||
_autoload_xontribs(env)
|
||||
if not shell_kwargs.get("norc"):
|
||||
_autoload_xontribs(env)
|
||||
_load_rc_files(shell_kwargs, args, env, execer, ctx)
|
||||
# create shell
|
||||
XSH.shell = Shell(execer=execer, **shell_kwargs)
|
||||
|
|
Loading…
Add table
Reference in a new issue