xonsh: update to version 0.14.1 (#9294)

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.
This commit is contained in:
OscarL
2023-08-30 16:17:20 -03:00
committed by GitHub
parent 756d1153a6
commit e7938b444b
3 changed files with 187 additions and 66 deletions

View File

@@ -0,0 +1,131 @@
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

View File

@@ -1,66 +0,0 @@
SUMMARY="Python-powered, cross-platform, Unix-gazing shell"
DESCRIPTION="xonsh is a Python-powered, cross-platform, Unix-gazing shell \
language and command prompt. The language is a superset of Python 3.5+ with \
additional shell primitives. xonsh (pronounced conch) is meant for the daily \
use of experts and novices alike."
HOMEPAGE="https://xon.sh/"
COPYRIGHT="2015-2019 the xonsh developers"
LICENSE="BSD (2-clause)"
REVISION="2"
SOURCE_URI="https://github.com/xonsh/xonsh/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="9d73273276996297920c234c7d4267a305c695f0e9e2454dbdf0655c3a8f75cb"
ARCHITECTURES="any"
PROVIDES="
$portName = $portVersion
"
REQUIRES="
haiku
"
BUILD_REQUIRES="
haiku_devel
"
PYTHON_PACKAGES=(python310)
PYTHON_VERSIONS=(3.10)
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
eval "PROVIDES_${pythonPackage}=\"\
${portName}_$pythonPackage = $portVersion\n\
cmd:xon.sh\n\
cmd:xonsh\n\
cmd:xonsh_cat\n\
\"; \
REQUIRES_$pythonPackage=\"\
haiku\n\
cmd:python$pythonVersion\n\
setuptools_$pythonPackage\n\
\""
BUILD_REQUIRES="$BUILD_REQUIRES
setuptools_$pythonPackage"
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
cmd:python$pythonVersion"
done
INSTALL()
{
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
python=python$pythonVersion
installLocation=$prefix/lib/$python/vendor-packages/
export PYTHONPATH=$installLocation:$PYTHONPATH
mkdir -p $installLocation
rm -rf build
$python setup.py build install \
--root=/ --prefix=$prefix
packageEntries $pythonPackage \
$prefix/lib/python* \
$binDir
done
}

View File

@@ -0,0 +1,56 @@
SUMMARY="Python-powered, cross-platform, Unix-gazing shell"
DESCRIPTION="xonsh is a Python-powered, cross-platform, Unix-gazing shell \
language and command prompt.
The language is a superset of Python 3.6+ with additional shell primitives. xonsh \
(pronounced conch) is meant for the daily use of experts and novices alike."
HOMEPAGE="https://xon.sh/"
COPYRIGHT="2015-2023 the xonsh developers"
LICENSE="BSD (2-clause)"
REVISION="1"
SOURCE_URI="https://github.com/xonsh/xonsh/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="de132cef00df4c7c0d1071dc26538cd266c6110c2b721fa02b933629a3bc9caa"
PATCHES="xonsh-$portVersion.patchset"
ARCHITECTURES="any"
# Ideally should match Haiku's default Python version.
pythonVersion=3.10
pythonPackage=python${pythonVersion//.}
PROVIDES="
$portName = $portVersion
cmd:xonsh
cmd:xonsh_cat
cmd:xonsh_uname
cmd:xonsh_uptime
"
REQUIRES="
haiku
prompt_toolkit_$pythonPackage
pygments_$pythonPackage
cmd:col
cmd:python$pythonVersion
"
REPLACES="
xonsh_python310
"
BUILD_REQUIRES="
build_$pythonPackage
installer_$pythonPackage
setuptools_$pythonPackage
wheel_$pythonPackage
"
BUILD_PREREQUIRES="
cmd:python$pythonVersion
"
INSTALL()
{
python=python$pythonVersion
$python -m build --wheel --skip-dependency-check --no-isolation
$python -m installer -p $prefix dist/*.whl
}