Skip to content

Commit b5ce195

Browse files
authored
feat(query): build image limit python 3.12.2 (#15501)
1 parent 1ff87bb commit b5ce195

File tree

1 file changed

+20
-28
lines changed

1 file changed

+20
-28
lines changed

scripts/setup/dev_setup.sh

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -131,35 +131,27 @@ function install_ziglang {
131131
}
132132

133133
function install_python3 {
134-
PACKAGE_MANAGER=$1
135-
136-
echo "==> installing python3..."
134+
echo "==> installing python3 via pyenv..."
135+
curl https://pyenv.run | bash
136+
137+
# Check if pyenv is already initialized in the profile
138+
if ! command -v pyenv >/dev/null; then
139+
# Add PYENV_ROOT to the profile
140+
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> $HOME/.profile
141+
# Check if pyenv is in the PATH
142+
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> $HOME/.profile
143+
# Initialize pyenv in the profile
144+
echo 'eval "$(pyenv init -)"' >> ~/.profile
145+
echo "pyenv environment variables have been added to ~/.profile"
146+
else
147+
echo "pyenv is already set in the environment variables."
148+
fi
137149

138-
case "$PACKAGE_MANAGER" in
139-
apt-get)
140-
install_pkg python3-all-dev "$PACKAGE_MANAGER"
141-
install_pkg python3-setuptools "$PACKAGE_MANAGER"
142-
install_pkg python3-pip "$PACKAGE_MANAGER"
143-
install_pkg libcairo2-dev "$PACKAGE_MANAGER"
144-
;;
145-
apk)
146-
install_pkg python3-dev "$PACKAGE_MANAGER"
147-
install_pkg py3-pip "$PACKAGE_MANAGER"
148-
install_pkg libffi-dev "$PACKAGE_MANAGER"
149-
;;
150-
brew | pacman)
151-
install_pkg python3 "$PACKAGE_MANAGER"
152-
install_pkg cairo "$PACKAGE_MANAGER"
153-
;;
154-
yum | dnf)
155-
install_pkg python3-devel "$PACKAGE_MANAGER"
156-
install_pkg cairo-devel "$PACKAGE_MANAGER"
157-
;;
158-
*)
159-
echo "Unable to install python3 with package manager: $PACKAGE_MANAGER"
160-
exit 1
161-
;;
162-
esac
150+
# Source the profile to apply changes to the current session
151+
source $HOME/.profile
152+
# install python3.12
153+
pyenv install 3.12.2
154+
pyenv global 3.12.2
163155
}
164156

165157
function install_openssl {

0 commit comments

Comments
 (0)