##// END OF EJS Templates
`AssertionError`: `assert _xterm_term_title_saved` in WSL (#14480)...
`AssertionError`: `assert _xterm_term_title_saved` in WSL (#14480) `AssertionError`: `assert _xterm_term_title_saved` In some (unknown) situation, it is possible that the `_xterm_term_title_saved` is unset, but the code would make a call to `_restore_term_title_xterm`, resulting in `AssertionError`. At least on replicatable reproduction is returning from `ipython` to `pudb` via `^D^D` on an empty cell. See more details in https://github.com/ipython/ipython/pull/14480 Signed-off-by: Stavros Ntentos <133706+stdedos@users.noreply.github.com> <details> <summary><em>was:</em></summary> In some (unknown) situation, it is possible that the `_xterm_term_title_saved` is unset, but the code would make a call to `_restore_term_title_xterm`, resulting in `AssertionError`. As title stacking does not seem to be getting traction (https://github.com/microsoft/terminal/issues/14575), do not set the `xterm` variants of `_set_term_title` / `_restore_term_title`. WSL detection: https://superuser.com/a/1749811/533196 Additionally, almost-`black` the file. </details>

File last commit:

r1752:af0aa7a3
r28838:9b8cd4a3 merge
Show More
pkginstall
119 lines | 3.2 KiB | text/plain | TextLexer
#!/bin/bash
#
# Simple installation shell script for Python packages.
#
# Usage:
# pkginstall PAKPREFIX [PYPACKAGE]
#
# PAKPREFIX: prefix of the package as distributed in the tarball.
#
# PYPACKAGE: name of the Python package as it will end up installed. If not
# given, it defaults to PAKPREFIX.
#
#-----------------------------------------------------------------------------
# Process command-line args
#
PAKPREFIX=$1
PYPACKAGE=${2:-$PAKPREFIX}
#-----------------------------------------------------------------------------
# Configure main variables
#
# Defaults for variables that the .cfg file may override.
PYTHON_DEFAULT=python
PREFIX_DEFAULT=$HOME/usr/local
# Read config file which may declare user values for these variables.
source ./pkginstall.cfg
# Set the variables we'll actually use, either from the config file or from our
# defaults.
PYTHON=${PYTHON-${PYTHON_DEFAULT}}
PREFIX=${PREFIX-${PREFIX_DEFAULT}}
#-----------------------------------------------------------------------------
# 'Main' code begins
#
# Find the actual python executable path
PYTHONX=$(which $PYTHON)
if [[ ! -x $PYTHONX ]]; then
echo "ERROR: no python executable found at given path: $PYTHON"
echo "Aborting."
exit 1
fi
# Python version information. PYTHONV holds a versioned string used to build
# the site-packages path for the actual Python version we'll use.
PYVER=$($PYTHONX -ESV 2>&1)
PYVER_MINOR=${PYVER#Python }
PYVER_MAJOR=${PYVER_MINOR:0:3}
PYTHONV=python${PYVER_MAJOR}
# Set prefixes and other variables for the installation path.
SITEPKG=${PREFIX}/lib/${PYTHONV}/site-packages
SITEPKG64=${PREFIX}/lib64/${PYTHONV}/site-packages
# User diagnostics of current config
echo "Configuration:"
echo " PYTHON : $PYTHON"
echo " PYTHONX : $PYTHONX"
echo " PREFIX : $PREFIX"
echo " SITEPKG : $SITEPKG"
echo " SITEPKG64: $SITEPKG64"
# Find tarball
tarball=$(ls *$PAKPREFIX*.tar.*)
if [[ -z $tarball ]]; then
echo "ERROR: tarball not found for $PYPACKAGE"
exit 1
fi
# Figure out the name of the directory and compression format to use to unpack
pakdir=$(echo $tarball | awk -F '.tar.' '{print $1}')
tarfmt=$(echo $tarball | awk -F '.tar.' '{print $2}')
if [[ $tarfmt == "gz" ]]; then
tarflag="z"
else
tarflag="j"
fi
# Unpack the tarball if needed
if [[ ! -d $pakdir ]]; then
echo "Unpacking tarball: $tarball"
tar -x -${tarflag} -f $tarball
if [[ ! -d $pakdir ]]; then
echo "Tarball $tarball unpacked to unexpected path, aborting"
exit 1
fi
fi
# Remove existing ${PYPACKAGE} to make sure the build doesn't pick up spurious
# things. We don't touch the bin/ dir or anything else because it's hard to
# know what goes there in advance. But this should prevent most serious
# problems.
rm -rf $SITEPKG/${PYPACKAGE}
rm -rf $SITEPKG/${PYPACKAGE}*.egg
rm -rf $SITEPKG/${PYPACKAGE}*.egg-info
rm -rf $SITEPKG64/${PYPACKAGE}
rm -rf $SITEPKG64/${PYPACKAGE}*.egg
rm -rf $SITEPKG64/${PYPACKAGE}*.egg-info
# Make/install phase
# Set python search path correctly
export PYTHONPATH=$SITEPKG:$SITEPKG64:$PYTHONPATH
# Ensure install dirs exist
mkdir -p $SITEPKG
mkdir -p $SITEPKG64
cd ${pakdir}
rm -rf build dist
$PYTHONX setup.py clean
time $PYTHONX setup.py install --prefix=$PREFIX