mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-08 21:00:05 +02:00
Also: - Fixed tab-completion when using libedit. - Avoid mentions of "~/.xonshrc". Point to, and use, ~/config/settings/xonsh/xonchrc instead. - Added "pygments" as a required package. It is listed as an optional dependency, but "xonfig web" (a command user will likely try as it is advertized at start-up) fails without it. - Silenced a startup error message, as it is known to be a libedit vs readline issue, and doesn't seems to affect normal usage. Will now warn against using libedit, and recommend installing the "gnureadline" Python module instead (currently, we don't have it on HaikuPorts). - require prompt_toolkit now that we have it. It provides a much more richer experience out of the box.
132 lines
4.5 KiB
Plaintext
132 lines
4.5 KiB
Plaintext
From c93cf24ed3ef89458350c9a0543f6a1046a9c1ae Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Mon, 28 Aug 2023 11:51:08 -0300
|
|
Subject: Fix tab-completion on Haiku
|
|
|
|
|
|
diff --git a/xonsh/readline_shell.py b/xonsh/readline_shell.py
|
|
index fb5fa48..37197b5 100644
|
|
--- a/xonsh/readline_shell.py
|
|
+++ b/xonsh/readline_shell.py
|
|
@@ -31,6 +31,7 @@ from xonsh.events import events
|
|
from xonsh.lazyasd import LazyObject, lazyobject
|
|
from xonsh.lazyimps import pyghooks, pygments, winutils
|
|
from xonsh.platform import (
|
|
+ ON_BEOS,
|
|
ON_CYGWIN,
|
|
ON_DARWIN,
|
|
ON_MSYS,
|
|
@@ -123,7 +124,7 @@ def setup_readline():
|
|
|
|
# handle tab completion differences found in libedit readline compatibility
|
|
# as discussed at http://stackoverflow.com/a/7116997
|
|
- if uses_libedit and ON_DARWIN:
|
|
+ if uses_libedit and (ON_DARWIN or ON_BEOS):
|
|
readline.parse_and_bind("bind ^I rl_complete")
|
|
print(
|
|
"\n".join(
|
|
--
|
|
2.37.3
|
|
|
|
|
|
From ccdf4ecc6d94e59c788009810bc7072488e548aa Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Mon, 28 Aug 2023 12:02:18 -0300
|
|
Subject: Do not print exception for known libedit related issue
|
|
|
|
|
|
diff --git a/xonsh/readline_shell.py b/xonsh/readline_shell.py
|
|
index 37197b5..fc4d39f 100644
|
|
--- a/xonsh/readline_shell.py
|
|
+++ b/xonsh/readline_shell.py
|
|
@@ -163,7 +163,8 @@ def setup_readline():
|
|
readline.read_init_file(inputrc_name)
|
|
except Exception:
|
|
# this seems to fail with libedit
|
|
- print_exception("xonsh: could not load readline default init file.")
|
|
+ if not uses_libedit:
|
|
+ print_exception("xonsh: could not load readline default init file.")
|
|
|
|
# Protection against paste jacking (issue #1154)
|
|
# This must be set after the init file is loaded since read_init_file()
|
|
--
|
|
2.37.3
|
|
|
|
|
|
From 9b068d3eea0cee49d31fedf8f78d475a697faea4 Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Mon, 28 Aug 2023 13:01:54 -0300
|
|
Subject: Avoid "~/.xonshrc", and look for "xonshrc" on
|
|
"~/config/settings/xonsh/" instead.
|
|
|
|
|
|
diff --git a/xonsh/environ.py b/xonsh/environ.py
|
|
index 7e2e5c8..5fc6658 100644
|
|
--- a/xonsh/environ.py
|
|
+++ b/xonsh/environ.py
|
|
@@ -628,7 +628,8 @@ def default_xonshrc(env) -> "tuple[str, ...]":
|
|
dxrc = (
|
|
os.path.join(xonsh_sys_config_dir(env), "xonshrc"),
|
|
os.path.join(xonsh_config_dir(env), "rc.xsh"),
|
|
- os.path.expanduser("~/.xonshrc"),
|
|
+ # os.path.expanduser("~/.xonshrc"),
|
|
+ os.path.join(xonsh_config_dir(env), "xonshrc"),
|
|
)
|
|
# Check if old config file exists and issue warning
|
|
old_config_filename = xonshconfig(env)
|
|
diff --git a/xonsh/webconfig/file_writes.py b/xonsh/webconfig/file_writes.py
|
|
index 59ddb4d..339d9a7 100644
|
|
--- a/xonsh/webconfig/file_writes.py
|
|
+++ b/xonsh/webconfig/file_writes.py
|
|
@@ -3,6 +3,9 @@ import os
|
|
import re
|
|
import typing as tp
|
|
|
|
+from xonsh.built_ins import XSH
|
|
+from xonsh.environ import xonsh_config_dir
|
|
+
|
|
RENDERERS: list[tp.Callable] = []
|
|
|
|
|
|
@@ -45,13 +48,15 @@ def config_to_xonsh(
|
|
|
|
def insert_into_xonshrc(
|
|
config,
|
|
- xonshrc="~/.xonshrc",
|
|
+ #xonshrc="~/.xonshrc",
|
|
+ xonshrc="xonshrc",
|
|
prefix="# XONSH WEBCONFIG START",
|
|
suffix="# XONSH WEBCONFIG END",
|
|
):
|
|
"""Places a config dict into the xonshrc."""
|
|
# get current contents
|
|
- fname = os.path.expanduser(xonshrc)
|
|
+ #fname = os.path.expanduser(xonshrc)
|
|
+ fname = os.path.join(xonsh_config_dir(getattr(XSH, "env", {}) or {}), xonshrc)
|
|
if os.path.isfile(fname):
|
|
with open(fname) as f:
|
|
s = f.read()
|
|
diff --git a/xonsh/xonfig.py b/xonsh/xonfig.py
|
|
index 9d011a2..5c80e32 100644
|
|
--- a/xonsh/xonfig.py
|
|
+++ b/xonsh/xonfig.py
|
|
@@ -790,13 +790,13 @@ WELCOME_MSG = [
|
|
("{{INTENSE_BLACK}}", "<", "-"),
|
|
"",
|
|
(
|
|
- "{{INTENSE_BLACK}}Create ~/.xonshrc file manually or use xonfig to suppress the welcome message",
|
|
+ "{{INTENSE_BLACK}}Create ~/config/settings/xonsh/xonshrc file manually or use xonfig to suppress the welcome message",
|
|
"^",
|
|
" ",
|
|
),
|
|
"",
|
|
"{{INTENSE_BLACK}}Start from commands:",
|
|
- " {{GREEN}}xonfig{{RESET}} web {{INTENSE_BLACK}}# Run the configuration tool in the browser to create ~/.xonshrc {{RESET}}",
|
|
+ " {{GREEN}}xonfig{{RESET}} web {{INTENSE_BLACK}}# Run the configuration tool in the browser to create ~/config/settings/xonsh/xonshrc {{RESET}}",
|
|
" {{GREEN}}xonfig{{RESET}} tutorial {{INTENSE_BLACK}}# Open the xonsh tutorial in the browser{{RESET}}",
|
|
"[SHELL_TYPE_WARNING]",
|
|
"",
|
|
--
|
|
2.37.3
|
|
|