# Copyright 2020 The Pigweed Authors # # 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 # # https://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. # This script must be tested on bash, zsh, and dash. _pw_abspath () { python -c "import os.path; print(os.path.abspath('$@'))" } _pw_red() { echo -e "\033[0;31m$*\033[0m" } _pw_bold_red() { echo -e "\033[1;31m$*\033[0m" } _pw_green() { echo -e "\033[0;32m$*\033[0m" } _pw_bright_magenta() { echo -e "\033[0;35m$*\033[0m" } _PIGWEED_BANNER=$(cat < /dev/null; then PYTHON=python else _pw_bold_red "Error: No system Python present\n" _pw_red " Pigweed's bootstrap process requires a local system Python." _pw_red " Please install Python on your system, add it to your PATH" _pw_red " and re-try running bootstrap." return fi $PYTHON $PW_ROOT/pw_env_setup/py/pw_env_setup/env_setup.py --shell-file $SETUP_SH else _pw_green " ACTIVATOR! This sets your shell environment variables.\n" fi . $SETUP_SH if [ $_PW_IS_BOOTSTRAP -eq 0 ]; then echo echo "To activate this environment in the future, run this in your terminal:" echo _pw_green " . activate.sh\n" fi unset _PW_IS_BOOTSTRAP unset _PIGWEED_BANNER unset _pw_abspath unset _pw_red unset _pw_bold_red unset _pw_green unset _pw_bright_magenta