61 lines
2.3 KiB
Bash
61 lines
2.3 KiB
Bash
|
#!/bin/sh
|
||
|
# -*- mode: sh; tab-width: 8; coding: utf-8-unix -*-
|
||
|
[ -z "$PYVER" ] && PYVER=3
|
||
|
export PYVER
|
||
|
#[ -f /usr/local/bin/usr_local_tput.bash ] && \
|
||
|
# . /usr/local/bin/usr_local_tput.bash
|
||
|
ROLE=base
|
||
|
declare -a RARGS
|
||
|
RARGS=("$@")
|
||
|
|
||
|
[ -f /usr/local/bin/pyver.sh ] && . /usr/local/bin/pyver.sh || {
|
||
|
[ -f /usr/local/etc/testforge/testforge.bash ] && \
|
||
|
. /usr/local/etc/testforge/testforge.bash >/dev/null
|
||
|
|
||
|
P="BASE_PYTHON${PYVER}_MINOR"
|
||
|
PYTHON_MINOR="$(eval echo \$$P)"
|
||
|
[ -n "$PYTHON_MINOR" ] || \
|
||
|
PYTHON_MINOR=$( python$PYVER --version 2>&1| sed -e 's@^.* @@' -e 's@\.[0-9]*$@@' )
|
||
|
|
||
|
if [ -z "$LIB" -a -d /usr/lib/python$PYTHON_MINOR ] ; then
|
||
|
LIB=lib
|
||
|
elif [ -z "$LIB" -a -d /usr/lib64/python$PYTHON_MINOR ] ; then
|
||
|
LIB=lib64
|
||
|
elif [ -n "$LIB" -a ! -d /usr/$LIB/python$PYTHON_MINOR ] ; then
|
||
|
ERROR LIB=$LIB but no /usr/$LIB/python$PYTHON_MINOR >&2 ; exit 1
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
if [ -z "$PYTHONPATH" ] ; then
|
||
|
# sic - failsafe
|
||
|
export PYTHONPATH=/usr/lib/python$PYTHON_MINOR/site-packages
|
||
|
fi
|
||
|
|
||
|
if [ -d /usr/$LIB/python$PYTHON_MINOR/site-packages/llvmlite/binding ] ; then
|
||
|
if [ -z "$LD_LIBRARY_PATH" ] ; then
|
||
|
export LD_LIBRARY_PATH=/usr/$LIB/python$PYTHON_MINOR/site-packages/llvmlite/binding
|
||
|
else
|
||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/$LIB/python$PYTHON_MINOR/site-packages/llvmlite/binding
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
# do I want $HOME/.local on the path? - no
|
||
|
# do I want local/lib/.../dist-packages on the path? - no is already is
|
||
|
# on Debian ~/.local/lib/python*/site-packages is already on the path
|
||
|
for elt in usr/local ; do
|
||
|
[ -d /$elt ] || continue
|
||
|
[ -d /$elt/bin ] && [[ ! $PATH =~ /$elt/bin ]] && \
|
||
|
export PATH=$PATH:/$elt/bin
|
||
|
[ -e /$elt/$LIB ] || continue
|
||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/$elt/$LIB
|
||
|
[ -d /$elt/$LIB/python$PYTHON_MINOR/site-packages ] || \
|
||
|
mkdir /$elt/$LIB/python$PYTHON_MINOR/site-packages
|
||
|
[ ! -f /$elt/$LIB/python$PYTHON_MINOR/site-packages/__init__.py ] && \
|
||
|
touch /$elt/$LIB/python$PYTHON_MINOR/site-packages/__init__.py
|
||
|
[[ ! $PYTHONPATH =~ /$elt/$LIB/python$PYTHON_MINOR/site-packages ]] && \
|
||
|
export PYTHONPATH=$PYTHONPATH:/$elt/$LIB/python$PYTHON_MINOR/site-packages
|
||
|
done
|
||
|
|
||
|
# echo INFO exec /usr/bin/python$PYTHON_MINOR -W ignore::DeprecationWarning "${RARGS[@]}"
|
||
|
/usr/bin/python$PYTHON_MINOR -W ignore::DeprecationWarning "${RARGS[@]}"
|