@leverege/build-tools 2.53.4 → 2.53.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/refresh-py-idx.sh +59 -90
package/package.json
CHANGED
package/src/refresh-py-idx.sh
CHANGED
|
@@ -1,107 +1,76 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
function leveregeBuildToolsRefreshPyIdx() {
|
|
4
|
+
# Execute gcloud command to get the token
|
|
5
|
+
local TOKEN=$(gcloud auth print-access-token)
|
|
5
6
|
|
|
6
|
-
# Write to pip.conf
|
|
7
|
-
PIP_CONFIG_DIR="$HOME/.config/pip"
|
|
8
|
-
mkdir -p "$PIP_CONFIG_DIR"
|
|
9
|
-
PIP_CONFIG_CONTENT="
|
|
10
|
-
[global]
|
|
11
|
-
extra-index-url = https://oauth2accesstoken:${TOKEN}@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple/
|
|
12
|
-
"
|
|
13
|
-
echo "$PIP_CONFIG_CONTENT" > "$PIP_CONFIG_DIR/pip.conf"
|
|
14
|
-
echo "Updated ~/.config/pip/pip.conf"
|
|
7
|
+
# Write to pip.conf
|
|
8
|
+
local PIP_CONFIG_DIR="$HOME/.config/pip"
|
|
9
|
+
mkdir -p "$PIP_CONFIG_DIR"
|
|
10
|
+
local PIP_CONFIG_CONTENT="
|
|
11
|
+
[global]
|
|
12
|
+
extra-index-url = https://oauth2accesstoken:${TOKEN}@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple/
|
|
13
|
+
"
|
|
14
|
+
echo "$PIP_CONFIG_CONTENT" > "$PIP_CONFIG_DIR/pip.conf"
|
|
15
|
+
echo "Updated ~/.config/pip/pip.conf"
|
|
15
16
|
|
|
16
|
-
# Write to pypirc
|
|
17
|
-
PYPIRC_CONTENT="
|
|
18
|
-
[distutils]
|
|
19
|
-
index-servers =
|
|
20
|
-
|
|
17
|
+
# Write to pypirc
|
|
18
|
+
local PYPIRC_CONTENT="
|
|
19
|
+
[distutils]
|
|
20
|
+
index-servers =
|
|
21
|
+
leverege-python-packages
|
|
21
22
|
|
|
22
|
-
[leverege-python-packages]
|
|
23
|
-
repository: https://us-python.pkg.dev/leverege-registry/leverege-python-packages/
|
|
24
|
-
username: oauth2accesstoken
|
|
25
|
-
password: ${TOKEN}
|
|
26
|
-
"
|
|
27
|
-
echo "$PYPIRC_CONTENT" > "$HOME/.pypirc"
|
|
28
|
-
echo "Updated ~/.pypirc"
|
|
23
|
+
[leverege-python-packages]
|
|
24
|
+
repository: https://us-python.pkg.dev/leverege-registry/leverege-python-packages/
|
|
25
|
+
username: oauth2accesstoken
|
|
26
|
+
password: ${TOKEN}
|
|
27
|
+
"
|
|
28
|
+
echo "$PYPIRC_CONTENT" > "$HOME/.pypirc"
|
|
29
|
+
echo "Updated ~/.pypirc"
|
|
29
30
|
|
|
30
|
-
# Escape for sed
|
|
31
|
-
UV_EXTRA_INDEX_URL="https://oauth2accesstoken:${TOKEN}@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple"
|
|
31
|
+
# Escape for sed
|
|
32
|
+
UV_EXTRA_INDEX_URL="https://oauth2accesstoken:${TOKEN}@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple"
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
local SHELLS=("bash" "dash" "zsh" "fish")
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
for shell in "${SHELLS[@]}"; do
|
|
37
|
+
if command -v "$shell" > /dev/null 2>&1; then
|
|
38
|
+
case "$shell" in
|
|
39
|
+
bash)
|
|
40
|
+
CONFIG_FILE="$HOME/.bashrc"
|
|
41
|
+
;;
|
|
42
|
+
dash)
|
|
43
|
+
CONFIG_FILE="$HOME/.profile"
|
|
44
|
+
;;
|
|
45
|
+
zsh)
|
|
46
|
+
CONFIG_FILE="$HOME/.zshrc"
|
|
47
|
+
;;
|
|
48
|
+
fish)
|
|
49
|
+
CONFIG_FILE="$HOME/.config/fish/config.fish"
|
|
50
|
+
;;
|
|
51
|
+
*)
|
|
52
|
+
echo "Shell $shell is not supported."
|
|
53
|
+
continue
|
|
54
|
+
;;
|
|
55
|
+
esac
|
|
36
56
|
|
|
37
|
-
|
|
38
|
-
if command -v "$shell" > /dev/null 2>&1; then
|
|
39
|
-
case "$shell" in
|
|
40
|
-
bash)
|
|
41
|
-
CONFIG_FILE="$HOME/.bashrc"
|
|
42
|
-
;;
|
|
43
|
-
dash)
|
|
44
|
-
CONFIG_FILE="$HOME/.profile"
|
|
45
|
-
;;
|
|
46
|
-
zsh)
|
|
47
|
-
CONFIG_FILE="$HOME/.zshrc"
|
|
48
|
-
;;
|
|
49
|
-
fish)
|
|
50
|
-
CONFIG_FILE="$HOME/.config/fish/config.fish"
|
|
51
|
-
;;
|
|
52
|
-
*)
|
|
53
|
-
echo "Shell $shell is not supported."
|
|
54
|
-
continue
|
|
55
|
-
;;
|
|
56
|
-
esac
|
|
57
|
+
echo "Updating shell configuration in $CONFIG_FILE"
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
if [ -f "$CONFIG_FILE" ]; then
|
|
60
|
+
if grep -q "export UV_EXTRA_INDEX_URL=" "$CONFIG_FILE"; then
|
|
61
|
+
sed -i '' "s|export UV_EXTRA_INDEX_URL=.*|export UV_EXTRA_INDEX_URL=${UV_EXTRA_INDEX_URL}|" "$CONFIG_FILE"
|
|
62
|
+
else
|
|
63
|
+
echo -e "\nexport UV_EXTRA_INDEX_URL=${UV_EXTRA_INDEX_URL}\n" >> "$CONFIG_FILE"
|
|
64
|
+
fi
|
|
63
65
|
else
|
|
64
66
|
echo -e "\nexport UV_EXTRA_INDEX_URL=${UV_EXTRA_INDEX_URL}\n" >> "$CONFIG_FILE"
|
|
65
67
|
fi
|
|
66
68
|
else
|
|
67
|
-
echo
|
|
69
|
+
echo "Shell $shell is not installed."
|
|
68
70
|
fi
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
fi
|
|
72
|
-
done
|
|
73
|
-
|
|
74
|
-
function get_parent_shell() {
|
|
75
|
-
echo ""
|
|
71
|
+
done
|
|
72
|
+
echo -e "\n\n--- Please source your shell configuration to apply the changes.\n"
|
|
76
73
|
}
|
|
77
74
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if [ -z "$shell" ]; then
|
|
81
|
-
echo -e "\nCould not determine parent shell. Please source your shell configuration to apply the changes.\n"
|
|
82
|
-
echo "Example (bash): source ~/.bashrc"
|
|
83
|
-
echo "Example (dash): source ~/.profile"
|
|
84
|
-
echo "Example (zsh): source ~/.zshrc"
|
|
85
|
-
echo "Example (fish): source ~/.config/fish/config.fish"
|
|
86
|
-
exit 1
|
|
87
|
-
fi
|
|
88
|
-
|
|
89
|
-
echo -e "\nReloading $shell shell with new configuration.\n"
|
|
90
|
-
|
|
91
|
-
case "$shell" in
|
|
92
|
-
bash)
|
|
93
|
-
source "$HOME/.bashrc"
|
|
94
|
-
;;
|
|
95
|
-
dash)
|
|
96
|
-
source "$HOME/.profile"
|
|
97
|
-
;;
|
|
98
|
-
zsh)
|
|
99
|
-
source "$HOME/.zshrc"
|
|
100
|
-
;;
|
|
101
|
-
fish)
|
|
102
|
-
fish
|
|
103
|
-
;;
|
|
104
|
-
*)
|
|
105
|
-
echo "Shell $shell is not supported."
|
|
106
|
-
;;
|
|
107
|
-
esac
|
|
75
|
+
# this will be exposed in the case of calling '. refresh-py-idx'
|
|
76
|
+
leveregeBuildToolsRefreshPyIdx
|