-
Notifications
You must be signed in to change notification settings - Fork 9
/
run_once_007_install_asdf.sh.tmpl
executable file
·47 lines (38 loc) · 1.55 KB
/
run_once_007_install_asdf.sh.tmpl
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
#!/bin/bash -e
{{ if eq .chezmoi.os "darwin" -}}
((brew info asdf | grep -i "not installed" 1>/dev/null) && brew install asdf) || echo "asdf already installed"
# Let's load asdf goodies now so that the user doesn't have to
# force re-open another shell just to load them.
. $(brew --prefix asdf)/libexec/asdf.sh
. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash
# Install python with the --enable-framework flag so that YouCompleteMe
# installs successfully. Note that asdf uses python-build (the same backend
# used by pyenv) to build and install Python. So the following env variable
# will be honored by asdf install python. Run `asdf --help python` for
# more information.
PYTHON_CONFIGURE_OPTS="--enable-framework"
{{ else if eq .chezmoi.os "linux" -}}
which asdf 1>/dev/null && echo "asdf already installed" && exit 0
ASDF_DIR="$HOME/.local/.asdf"
rm -rf $ASDF_DIR
git clone https://github.com/asdf-vm/asdf.git $ASDF_DIR --branch v0.12.0
# Let's load asdf goodies now so that the user doesn't have to
# force re-open another shell just to load them.
. $ASDF_DIR/asdf.sh
. $ASDF_DIR/completions/asdf.bash
rm -f ~/bin/asdf
export PATH="$PATH:$ASDF_DIR/bin"
{{ end -}}
if ! asdf plugin list | grep python; then
asdf plugin add python
fi
pythonver="3.11.4"
if asdf list python "$pythonver" | grep "$pythonver"; then
echo "Python $pythonver already installed!"
else
asdf install python $pythonver
fi
asdf global python "$pythonver"
if [ ! -e ~/.tool-versions ] || ! grep 'python' ~/.tool-versions; then
echo 'python $pythonver' >> $HOME/.tool-versions
fi