Skip to content

Commit 3a0795e

Browse files
committed
small refactor
1 parent d183120 commit 3a0795e

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

Diff for: docs/scripts/build-api-docs.sh

+22-12
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,34 @@
99

1010
set -e
1111

12-
# Required to resolve `locale.Error: unsupported locale setting`
13-
export LC_ALL=en_US.UTF-8
14-
15-
# Vercel-specific commands and configurations
16-
if ! [[ "$OSTYPE" =~ "darwin"* ]]; then
17-
echo "Detected non-Darwin host. Running Vercel-specific commands and configurations"
18-
19-
if ! command -v uv &> /dev/null; then
20-
curl -LsSf https://astral.sh/uv/install.sh | sh
21-
22-
# shellcheck source=/dev/null
23-
source "$HOME/.local/bin/env"
12+
uv_install() {
13+
if command -v uv &>/dev/null; then
14+
echo "uv is already installed in this environment..."
15+
else
16+
curl -LsSf https://astral.sh/uv/install.sh | sh
17+
source "$HOME/.local/bin/env"
2418
fi
19+
}
2520

21+
uv_activate_venv() {
2622
uv python install 3.11
2723
uv venv
2824
source .venv/bin/activate
2925
uv pip install tox
26+
}
27+
28+
# https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL
29+
if [ "$VERCEL" = "1" ]; then
30+
echo "Detected Vercel environment. Running Vercel-specific commands and configurations."
31+
# Required to resolve `locale.Error: unsupported locale setting`
32+
export LC_ALL=C.UTF-8
33+
uv_install
34+
uv_activate_venv
35+
fi
36+
37+
# Required to resolve `locale.Error: unsupported locale setting`
38+
if [[ -z "$LC_ALL" && "$(uname)" == "Darwin" ]]; then
39+
export LC_ALL=en_US.UTF-8
3040
fi
3141

3242
echo "Running sphinx-mdx and copying files to \`docs/api/python-api\`"

0 commit comments

Comments
 (0)