Skip to content

Commit

Permalink
Add shell scripts for jython and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Helmling committed Dec 17, 2009
1 parent ceca4ee commit 960ef8b
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 0 deletions.
22 changes: 22 additions & 0 deletions bin/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

# get the full path to the jython script
prgdir=$(
prg=$0
case $prg in
(*/*) ;;
(*) [ -e "$prg" ] || prg=$(command -v -- "$0")
esac
prgbase=$(dirname -- "$prg")
cd -P -- "$prgbase" > /dev/null && pwd -P
)
basedir=$( cd -P -- "$prgdir/.." > /dev/null && pwd -P )
for f in `ls $basedir/lib/*.jar`;
do
CP=$CP:$f;
done
CP=$CP:$basedir/conf
export CP
65 changes: 65 additions & 0 deletions bin/jython
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

# get the full path to the jython script
prgdir=$(
prg=$0
case $prg in
(*/*) ;;
(*) [ -e "$prg" ] || prg=$(command -v -- "$0")
esac
prgbase=$(dirname -- "$prg")
cd -P -- "$prgbase" > /dev/null && pwd -P
)
basedir=$( cd -P -- "$prgdir/.." > /dev/null && pwd -P )
. $basedir/bin/env.sh
# Default settings
if [ -z "$JAVA" ]; then
if [ -n "$JAVA_HOME" ]; then
JAVA=$JAVA_HOME/bin/java
else
JAVA=`which java`
fi
fi
if [ -z "$JAVA" ]; then
echo "No Java found. Set JAVA or JAVA_HOME."
exit 1
fi
if [ -z "$JYTHON_CP" ]; then
JYTHON_CP=$CP
fi
if [ -z "$JAVA_OPTS" ]; then
JAVA_OPTS="-Xmx2048M -XX:MaxPermSize=128M"
fi
if [ -z "$LOG4J_OPTS" ]; then
LOG4J_OPTS="-Dlog4j.configuration=log4j.properties" # to change default log level add -Dlog4j.info
fi
# set jython's cache directory to a hidden dir in our current dir
cachedir=/tmp/.cachedir
cacheskip=false
# default the jython home to the jython test dir
pyhome=$basedir/src/jython
# additional paths for python code
pypath=$basedir/conf:$pypath
# setup readline options (if libreadline-java available)
# to use this you'll need to "emerge libreadline-java"
if [ -f /usr/share/libreadline-java/lib/libreadline-java.jar ];
then
JYTHON_CP=$JYTHON_CP:/usr/share/libreadline-java/lib/libreadline-java.jar
export LD_LIBRARY_PATH=/usr/lib64/libreadline-java:$LD_LIBRARY_PATH
PYOPTS="-Dpython.console=org.python.util.ReadlineConsole -Dpython.console.readlinelib=GnuReadline"
fi
#echo "JYTHON_CP=$JYTHON_CP"
# exec, and also allow python access to private vars
exec $JAVA -cp "$JYTHON_CP" $JAVA_OPTS $SSL_OPTS $LOG4J_OPTS -D"python.security.respectJavaAccessibility=false" -D"python.cachedir=$cachedir" -D"python.path=$pyhome:$pypath" -D"python.cachedir.skip=$cacheskip" $PYOPTS org.python.util.jython "$@"
45 changes: 45 additions & 0 deletions bin/jyunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# get the full path to the jython script
prgdir=$(
prg=$0
case $prg in
(*/*) ;;
(*) [ -e "$prg" ] || prg=$(command -v -- "$0")
esac
prgbase=$(dirname -- "$prg")
cd -P -- "$prgbase" > /dev/null && pwd -P
)
basedir=$( cd -P -- "$prgdir/.." > /dev/null && pwd -P )
. $prgdir/env.sh
JYTHON_CP=$CP:$basedir/build
export JYTHON_CP
#export LOG4J_OPTS="-Dlog4j.configuration=log4j_test.properties" # to change default log level add -Dlog4j.info
# quick compile if -c arg provided
if [ "$1" = "-c" ]
then
ant compile
shift
fi
# run with jdb if -d arg provided
if [ "$1" = "-d" ]
then
export JAVA="$JAVA_HOME/bin/jdb"
shift
fi
# cater to memory-hoggin tests
#if [ -z "$JVM_OPTS" ];
#then
# export JVM_OPTS="-Xmx768m"
#fi
# additional paths for python code
export pypath=$basedir/test/jython
. $prgdir/jython
4 changes: 4 additions & 0 deletions bin/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

BASEDIR=`dirname $0`
$BASEDIR/jyunit $BASEDIR/../src/jython/jyunit/run.py $@

0 comments on commit 960ef8b

Please sign in to comment.