#!/bin/sh
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../pypy/pypy.wrapper
# Copyright (C) 2007 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

pypy={PYPYDIR}

help_msg()
  {
	echo "$0 [command] [options]"
	echo "Possible commands:"
	cd $pypy/pypy/bin/
	for x in $(ls *.py)
	do
	if [ -x $x ]; then
		echo "	$(echo $x | sed 's,\.\w*$,,')"
	fi
	done
  }

if [ $# -eq 0 ];then
	file="py"
else
	file=$1
fi

case "$1" in
	-*) help_msg;exit 1;;
	--*) hlp_msg;exit 1;;
esac

if [ ! -x $pypy/pypy/bin/$file.py ];then
	echo "Error: command $file is not executable."
	help_msg
	exit 1
fi
shift
exec "$pypy/pypy/bin/$file.py" "$@"