Skip to content

Commit

Permalink
add a root rbt wrapper. this is the same one we use in the aurora rep…
Browse files Browse the repository at this point in the history
…ository.

Testing Done:
./rbt

Reviewed at https://rbcommons.com/s/twitter/r/38/

(sapling split of 2d62f5d8a4e949c892826866d1556836fc646e23)
  • Loading branch information
wickman committed Mar 3, 2014
1 parent 4890a20 commit 044ad56
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
.pydevproject
bin/
build/
build-support/*.pex
build-support/*.venv
build-support/virtualenv-*
build-support/phab/
codegen/classes/
dist/
Expand Down
27 changes: 27 additions & 0 deletions build-support/virtualenv
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Wrapper for self-bootstrapping virtualenv
set -ex
VIRTUALENV_VERSION=1.10.1

if which python2.7 >/dev/null; then
PY=`which python2.7`
elif which python2.6 >/dev/null; then
PY=`which python2.6`
else
echo 'No python interpreter found on the path. Python will not work!' 1>&2
exit 1
fi

echo "Using $PY" >&2

HERE=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)
if ! [ -f "$HERE/virtualenv-$VIRTUALENV_VERSION/BOOTSTRAPPED" ]; then
pushd "$HERE"
curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-$VIRTUALENV_VERSION.tar.gz
tar zxvf virtualenv-$VIRTUALENV_VERSION.tar.gz
# TODO(ksweeney): Checksum
touch virtualenv-$VIRTUALENV_VERSION/BOOTSTRAPPED # 2PC
popd
fi

exec "$PY" "$HERE/virtualenv-$VIRTUALENV_VERSION/virtualenv.py" "$@"
34 changes: 34 additions & 0 deletions rbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
#
# Copyright 2013 Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License 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.
#
# Wrapper script for self-bootstrapping rbt.
set -e

HERE=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)
RBTOOLS_VERSION=0.5.5
if ! [ -f "$HERE/build-support/rbt.venv/BOOTSTRAPPED" ] || \
[ x`cat "$HERE/build-support/rbt.venv/BOOTSTRAPPED"` != x$RBTOOLS_VERSION ]; then

echo Bootstrapping rbtools @ $RBTOOLS_VERSION
rm -fr "$HERE/build-support/rbt.venv"
"$HERE/build-support/virtualenv" "$HERE/build-support/rbt.venv"
source "$HERE/build-support/rbt.venv/bin/activate"
pip install "RBTools==$RBTOOLS_VERSION"
echo $RBTOOLS_VERSION > "$HERE/build-support/rbt.venv/BOOTSTRAPPED"
fi
source "$HERE/build-support/rbt.venv/bin/activate"
# TODO(kevints): Use ./pants py here instead of virtualenv.
exec rbt "$@"

0 comments on commit 044ad56

Please sign in to comment.