forked from apache/airflow
-
Notifications
You must be signed in to change notification settings - Fork 1
/
breeze
executable file
·87 lines (81 loc) · 3.29 KB
/
breeze
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
set -euo pipefail
MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BREEZE_BINARY=breeze
COLOR_RED=$'\e[31m'
COLOR_BLUE=$'\e[34m'
COLOR_RESET=$'\e[0m'
COLOR_YELLOW=$'\e[33m'
function manual_instructions() {
echo
echo "${COLOR_BLUE}Please run those commands manually (you might need to restart shell between them)${COLOR_RESET}"
echo
echo " python -m pip install pipx"
echo " pipx ensurepath"
echo " pipx install -e '${MY_DIR}/dev/breeze/'"
echo " breeze setup-autocomplete --force"
echo
echo " After that, both pipx and breeze should be available on your path"
echo
exit 1
}
function check_breeze_installed() {
set +e
command -v "${BREEZE_BINARY}" >/dev/null
local breeze_on_path=$?
command -v "pipx" >/dev/null
local pipx_on_path=$?
set -e
if [[ ${breeze_on_path} != "0" || ${pipx_on_path} != "0" ]]; then
echo
if [[ ${pipx_on_path} != 0 ]]; then
echo "${COLOR_RED}The 'pipx' is not on path. It should be installed and 'pipx' should be available on your PATH.${COLOR_RESET}"
export TIMEOUT=0
if "${MY_DIR}/scripts/tools/confirm" "Installing pipx?"; then
python -m pip install pipx --upgrade
echo
echo "${COLOR_YELLOW}Please close and re-open the shell and retry. You might need to add 'pipx' to the PATH!${COLOR_RESET}"
echo
exit
else
manual_instructions
fi
fi
if [[ ${breeze_on_path} != 0 ]]; then
echo "${COLOR_RED}The '${BREEZE_BINARY}' is not on path. Breeze should be installed and 'breeze' should be available on your PATH!${COLOR_RESET}"
export TIMEOUT=0
echo
echo "${COLOR_YELLOW}Installing Breeze. This will install breeze via pipx and modify your local rc file for ${SHELL}${COLOR_RESET}"
echo
if "${MY_DIR}/scripts/tools/confirm" "installing and modifying the startup scripts"; then
pipx ensurepath --force
pipx install -e "${MY_DIR}/dev/breeze/" --force
${BREEZE_BINARY} setup-autocomplete --force --answer yes
echo
echo "${COLOR_YELLOW}Please close and re-open the shell and retry. Then rerun your last command!${COLOR_RESET}"
echo
exit
else
manual_instructions
fi
fi
fi
}
check_breeze_installed
${BREEZE_BINARY} "${@}"