78 lines
2.4 KiB
Bash
Executable File
78 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# -*-mode: sh; tab-width: 8; coding: utf-8-unix -*-
|
|
|
|
PREFIX=/usr/local
|
|
ROLE=proxy
|
|
|
|
[ -f /usr/local/etc/testforge/testforge.bash ] && \
|
|
. /usr/local/etc/testforge/testforge.bash || exit 1
|
|
. /usr/local/src/usr_local_src.bash || exit 2
|
|
. /usr/local/bin/usr_local_tput.bash || exit 3
|
|
|
|
DESC=""
|
|
export LOG_DIR=$PREFIX/var/log/$ROLE
|
|
prog=`basename $0 .bash`
|
|
|
|
[ $( id -u ) -eq 0 ] && { WARN "this should not be run as root" ; }
|
|
|
|
if [ "$#" -eq 0 ] ; then
|
|
|
|
[ -n "$BASE_USR_LOCAL" ] && PREFIX=$BASE_USR_LOCAL
|
|
#[ -n "$BASE_PYTHON2_MINOR" ] && BASE_PYTHON2_MINOR="`python2 --version 2>&1| sed -e 's@^.* @@' -e 's@\.[0-9]*$@@'`"
|
|
#[ -n "$BASE_PYTHON3_MINOR" ] && BASE_PYTHON3_MINOR="`python3 --version 2>&1| sed -e 's@^.* @@' -e 's@\.[0-9]*$@@'`"
|
|
|
|
for PYTHON_MINOR in $BASE_PYTHON2_MINOR $BASE_PYTHON3_MINOR ; do
|
|
[ -z "$PYTHON_MINOR" ] && continue
|
|
# [ "$PYTHON_MINOR" = "$BASE_PYTHON2_MINOR" ] && PYMAJOR=2 || PYMAJOR=3
|
|
PYVER="${PYTHON_MINOR:0:1}"
|
|
|
|
# echo DEBUG: $0 called from $PWD
|
|
|
|
#? chmod 1777 $site_packages
|
|
|
|
site_packages=$PREFIX/$LIB/python$PYTHON_MINOR/site-packages
|
|
[ -d $site_packages ] || mkdir -p $site_packages
|
|
# required
|
|
[ -e $site_packages/__init__.py ] || touch $site_packages/__init__.py
|
|
|
|
if [ ! -f $PREFIX/bin/python${PYVER}.sh ] ; then
|
|
echo ERROR: $prog missing $PREFIX/bin/python${PYVER}.sh
|
|
exit 4
|
|
elif [ -e $PREFIX/bin/python${PYVER}.bash -a ! -h $PREFIX/bin/python${PYVER}.bash ] ; then
|
|
# leftover from bootstrap
|
|
rm $PREFIX/bin/python${PYVER}.bash
|
|
ln -s $PREFIX/bin/python${PYVER}.sh $PREFIX/bin/python${PYVER}.bash
|
|
fi
|
|
|
|
chmod 755 $PREFIX/bin/python${PYVER}.sh
|
|
|
|
chmod 755 $PREFIX/bin/pip${PYVER}.sh
|
|
[ -e $PREFIX/bin/pip ] || \
|
|
ln $PREFIX/bin/pip${PYVER}.sh $PREFIX/bin/pip
|
|
|
|
[ -e $PREFIX/bin/nosetests${PYVER}.sh ] || \
|
|
{ echo exec $PREFIX/bin/python${PYVER}.sh `which nosetests` '"$@"' > $PREFIX/bin/nosetests${PYVER}.sh ; \
|
|
chmod 775 $PREFIX/bin/nosetests${PYVER}.sh ; }
|
|
|
|
done
|
|
exit 0
|
|
elif [ "$1" = check ] ; then
|
|
|
|
msys_var_local_src_prog_key $1 || exit 10$?
|
|
|
|
elif [ "$1" = 'lint' ] ; then
|
|
# sudo chown -R 1000:4 /usr/local/var/log/testforge/shellcheck
|
|
msys_var_local_src_prog_key $1 || exit 20$?
|
|
# ols_run_tests_shellcheck $ROLE || exit 21$?
|
|
# ols_run_tests_pylint || exit 22$?
|
|
|
|
elif [ "$1" = 'test' ] ; then
|
|
|
|
msys_var_local_src_prog_key $1 || exit 51$?
|
|
|
|
fi
|
|
|
|
#? FixMe: sed *sed - just /var/local
|
|
# bash $PREFIX/bin/testforge_local_bin.bash
|
|
exit 0
|