diff options
| author | bozo.kopic <bozo@kopic.xyz> | 2021-02-13 15:54:13 +0100 |
|---|---|---|
| committer | bozo.kopic <bozo@kopic.xyz> | 2021-02-13 15:54:13 +0100 |
| commit | 67b68e9983b6453aa026f0cd0211bc72ed257701 (patch) | |
| tree | 2704ab297ec80d1a7b5e718320529925c933a3aa /python | |
| parent | 50388dca816fb7b45cdcaa8ffa2c932d250c981f (diff) | |
.
Diffstat (limited to 'python')
| -rwxr-xr-x | python/install.sh | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/python/install.sh b/python/install.sh index fe083b8..1d7fa82 100755 --- a/python/install.sh +++ b/python/install.sh @@ -6,34 +6,34 @@ symlink () { ln -sfT "$@" } -PYTHON38=$(which python3.8) -PYTHON39=$(which python3.9) +install_python() { + LONG=$1 + SHORT=${LONG//\./} -PYTHON38_DIR=~/python38 -PYTHON39_DIR=~/python39 + PYTHON_BIN=$(command -v "python$LONG") + if [ ! -z $PYTHON_BIN ]; then -PIP38=$PYTHON38_DIR/bin/pip3.8 -PIP39=$PYTHON39_DIR/bin/pip3.9 + PYTHON_DIR=~/python$SHORT + PIP_BIN=$PYTHON_DIR/bin/pip$LONG + REQUIREMENTS=~/.dotfiles/python/requirements.pip$SHORT.txt + LOCAL_PYTHON_BIN=~/bin/python$LONG + LOCAL_PIP_BIN=~/bin/pip$LONG + LOCAL_DOIT_BIN=~/bin/doit$LONG -[ ! -d $PYTHON38_DIR ] && $PYTHON38 -m venv --system-site-packages $PYTHON38_DIR -[ ! -d $PYTHON39_DIR ] && $PYTHON39 -m venv --system-site-packages $PYTHON39_DIR + [ ! -d $PYTHON_DIR ] && \ + $PYTHON_BIN -m venv --system-site-packages $PYTHON_DIR -$PIP38 -q install -U -r ~/.dotfiles/python/requirements.pip38.txt -$PIP39 -q install -U -r ~/.dotfiles/python/requirements.pip39.txt + $PIP_BIN -q install -U -r $REQUIREMENTS -cat > ~/bin/python3.8 << EOF -#!/bin/sh -exec $(cd $PYTHON38_DIR; pwd)/bin/python3.8 "\$@" -EOF -cat > ~/bin/python3.9 << EOF -#!/bin/sh -exec $(cd $PYTHON39_DIR; pwd)/bin/python3.9 "\$@" -EOF -chmod +x ~/bin/python3.8 -chmod +x ~/bin/python3.9 + echo "#!/bin/sh" > $LOCAL_PYTHON_BIN + echo "exec $(cd $PYTHON_DIR; pwd)/bin/python$LONG \"\$@\"" >> $LOCAL_PYTHON_BIN + chmod +x $LOCAL_PYTHON_BIN -symlink $PIP38 ~/bin/pip3.8 -symlink $PIP39 ~/bin/pip3.9 + symlink $PIP_BIN $LOCAL_PIP_BIN + symlink $PYTHON_DIR/bin/doit $LOCAL_DOIT_BIN + + fi +} -symlink $PYTHON38_DIR/bin/doit ~/bin/doit3.8 -symlink $PYTHON39_DIR/bin/doit ~/bin/doit3.9 +install_python 3.8 +install_python 3.9 |
