Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 68 lines (60 sloc) 2.473 kB
#!/bin/bash
# ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the License.
# You may obtain a copy of the License in the LICENSE file, or at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==================================================================================================
MY_DIR=$(dirname $0)
VIRTUAL_PYTHON=$MY_DIR/.python/bootstrap
PANTS_EXE=$MY_DIR/src/python/twitter/pants/bin/pants_exe.py
MAKO_EGG=$MY_DIR/3rdparty/python/Mako-0.4.0-py2.6.egg
MARKDOWN_EGG=$MY_DIR/3rdparty/python/Markdown-2.1.1-py2.6.egg
PYGMENTS_EGG=$MY_DIR/3rdparty/python/Pygments-1.4-py2.6.egg
PYTHON_DAEMON_EGG=$MY_DIR/3rdparty/python/python_daemon-1.6-py2.6.egg
function run_pants_bare() {
source $VIRTUAL_PYTHON/bin/activate
PYTHONPATH=$MAKO_EGG:$MARKDOWN_EGG:$PYGMENTS_EGG:$PYTHON_DAEMON_EGG:$MY_DIR/src/python python $PANTS_EXE "$@"
deactivate
}
if [ ! -e $VIRTUAL_PYTHON/bin/python ]; then
$MY_DIR/build-support/python/setup.sh
rc=$?
if [[ $rc != 0 ]]; then
echo "Unable to bootstrap a sane Python virtual environment for pants!"
rm -rf $VIRTUAL_PYTHON
exit $rc
fi
source $VIRTUAL_PYTHON/bin/activate
deactivate
fi
if [ -z "${PANTS_DEV}" -a ! -e $MY_DIR/pants.pex ]; then
run_pants_bare src/python/twitter/pants:pants
if [ ! -e $MY_DIR/dist/pants.pex ]; then
echo "Unable to build pants! Cannot continue!"
exit 1
else
mv $MY_DIR/dist/pants.pex $MY_DIR/pants.pex
cp $MY_DIR/pants.pex $VIRTUAL_PYTHON/pants.pex
fi
fi
if [ -z "$ANT_OPTS" ]; then
export ANT_OPTS="-Xmx1g -XX:MaxPermSize=512m"
fi
if [ ! -z "${PANTS_DEV}" ]; then
# TODO(John Sirois): ideally this would just use pants.pex to run the pants target in py mode:
# ./pants.pex py src/python/twitter/pants "$@"
echo "*** running pants in dev mode from $PANTS_EXE ***"
run_pants_bare "$@"
else
${MY_DIR}/pants.pex "$@"
fi
Jump to Line
Something went wrong with that request. Please try again.