#!/bin/sh
# Script to patch the server from the local developer area.  The user's
# stuff goes into xbin/xlib/xpython directories, which are in front of
# the server's own bin/lib/python directories.  So anything in x* will
# be picked up in preference to the server-distributed files.

R=${WMCORE_ROOT-$(dirname $(dirname $0))}
[ X"$R" = X ] && { echo '$WMCORE_ROOT not set' 1>&2; exit 1; }

[ -x $R/bin/wmc-dist-patch ] || { echo "$R does not appear to be the right place" 1>&2; exit 1; }

set -ex
rm -fr $R/x{lib,bin,python,data,doc}/{*,.??*}
python setup.py build_system ${1+"$@"}
python setup.py install_system ${1+"$@"} --patch --prefix=$R
