]> gitweb.fluxo.info Git - trashman.git/commitdiff
Fix: hoarder: pyenv: install shell initialization scripts with profile.d scheme is...
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 7 Jul 2022 16:48:08 +0000 (13:48 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 7 Jul 2022 16:48:08 +0000 (13:48 -0300)
share/hoarder/pyenv/unix/install [deleted file]
share/hoarder/pyenv/unix/linux/debian/files/profile.sh [new file with mode: 0644]
share/hoarder/pyenv/unix/linux/debian/install [new file with mode: 0755]

diff --git a/share/hoarder/pyenv/unix/install b/share/hoarder/pyenv/unix/install
deleted file mode 100755 (executable)
index eedc5da..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env sh
-#
-# Install pyenv
-#
-
-# Parameters
-SHARE="$1"
-LIB="$2"
-
-# Include basic functions
-. $LIB/trashman/functions || exit 1
-. $LIB/trashman/debian    || exit 1
-
-# Requirements
-trashman_apt_install git
-
-# Setup pyenv from installer script
-#mkdir -p $HOME/.local/bin $HOME/.local/share
-#cd $HOME/.local/bin
-#wget https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer
-#chmod +x pyenv-installer
-#./pyenv-installer
-
-# Setup pyenv by cloning it's repository
-if [ ! -d "$HOME/.pyenv" ]; then
-  git clone https://github.com/pyenv/pyenv.git $HOME/.pyenv
-else
-  ( cd $HOME/.pyenv && git pull )
-fi
diff --git a/share/hoarder/pyenv/unix/linux/debian/files/profile.sh b/share/hoarder/pyenv/unix/linux/debian/files/profile.sh
new file mode 100644 (file)
index 0000000..1e4111a
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# PyEnv initialization script
+#
+# This file is meant to be source by your shell initialization script.
+#
+# See https://github.com/pyenv/pyenv
+#
+
+if [ -d "$HOME/.pyenv" ]; then
+  export PYENV_ROOT="$HOME/.pyenv"
+  command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
+
+  PATH="$(bash --norc -ec 'IFS=:; paths=($PATH); for i in ${!paths[@]}; do if [[ ${paths[i]} == "'$HOME/.pyenv/shims'" ]]; then unset '\''paths[i]'\''; fi; done; echo "${paths[*]}"')"
+  PATH="$HOME/.pyenv/shims:${PATH}"
+
+  if [ "$0" = "bash" ]; then
+    export PYENV_SHELL=bash
+    source '$HOME/.pyenv/libexec/../completions/pyenv.bash'
+  elif [ "$0" = "bash" ]; then
+    export PYENV_SHELL=zsh
+    source '$HOME/.pyenv/libexec/../completions/pyenv.zsh'
+  fi
+
+  command pyenv rehash 2>/dev/null
+
+  pyenv() {
+    local command
+    command="${1:-}"
+
+    if [ "$#" -gt 0 ]; then
+      shift
+    fi
+
+    case "$command" in
+      rehash|shell)
+        eval "$(pyenv "sh-$command" "$@")"
+        ;;
+      *)
+        command pyenv "$command" "$@"
+        ;;
+    esac
+  }
+fi
diff --git a/share/hoarder/pyenv/unix/linux/debian/install b/share/hoarder/pyenv/unix/linux/debian/install
new file mode 100755 (executable)
index 0000000..020987a
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/env sh
+#
+# Install pyenv
+# https://github.com/pyenv/pyenv
+#
+
+# Parameters
+SHARE="$1"
+LIB="$2"
+
+# Include basic functions
+. $LIB/trashman/functions || exit 1
+. $LIB/trashman/debian    || exit 1
+
+# Requirements for getting pyenv
+trashman_apt_install git
+
+# Requirements for compiling python
+trashman_apt_install apt-get make build-essential libssl-dev zlib1g-dev \
+  libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
+  libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
+
+# Setup pyenv from installer script
+#mkdir -p $HOME/.local/bin $HOME/.local/share
+#cd $HOME/.local/bin
+#wget https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer
+#chmod +x pyenv-installer
+#./pyenv-installer
+
+# Setup pyenv by cloning it's repository
+if [ ! -d "$HOME/.pyenv" ]; then
+  git clone https://github.com/pyenv/pyenv.git $HOME/.pyenv
+else
+  ( cd $HOME/.pyenv && git pull )
+fi
+
+# Setup the initialization script the $HOME/.profile.d folder scheme is used
+if [ -d "$HOME/.profile.d" ]; then
+  cp $SHARE/pyenv/unix/linux/debian/files/profile.sh $HOME/.profile.d/pyenv
+else
+  echo "Please configure your shell initialization script according to the PyEnv documentation"
+  echo "See https://github.com/pyenv/pyenv for details"
+fi
+
+# Inform
+trashman_installed_at $HOME/.pyenv
+trashman_run_with $HOME/.pyenv/bin/pyenv