| #!/usr/bin/env bash |
| # |
| # 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 pants. |
| set -e |
| |
| HERE=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd) |
| PANTS_VERSION=$(cat $HERE/.pantsversion) |
| # Pinned pants requirements - to upgrade pants change this file. |
| PANTS_REQUIREMENTS="$HERE/build-support/pants_requirements.txt" |
| if ! [ -f "$HERE/build-support/pants.venv/BOOTSTRAPPED" ] || \ |
| [[ $(< "$HERE/build-support/pants.venv/BOOTSTRAPPED") != $PANTS_VERSION ]]; then |
| |
| echo Bootstrapping pants @ $PANTS_VERSION |
| rm -fr "$HERE/build-support/pants.venv" |
| "$HERE/build-support/virtualenv" "$HERE/build-support/pants.venv" |
| # TODO(ksweeney): remove this hack when https://github.com/pantsbuild/pex/issues/21 is fixed. |
| rm -fr "$HERE/build-support/pants.venv/local" |
| source "$HERE/build-support/pants.venv/bin/activate" |
| pip install -r "$PANTS_REQUIREMENTS" |
| echo $PANTS_VERSION > "$HERE/build-support/pants.venv/BOOTSTRAPPED" |
| fi |
| source "$HERE/build-support/pants.venv/bin/activate" |
| exec pants "$@" |