diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index 1a843ce..3bda802 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -1020,6 +1020,33 @@ spcd_f_py_clone() { fi } +spcd_f_py_install() { + spcd_step "Install package" + spcd_f_pm_pkg_install "${SPCD_PYTHON_PACKAGE}" + spcd_step "Link alias to command" + spcd_f_py_link "${SPCD_PYTHON_COMMAND}" + # venv + spcd_step_in "Virtual environment" + spcd_step "Install package" + case "${SPCD_OS_ID}" in + "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") + spcd_f_pm_pkg_install "python3-venv" + ;; + *) ;; + esac + spcd_step "Configure PIP" + spcd_os_write "/etc/pip.conf" "\ +[global] +index-url = ${SPCD_URL_PYTHON}/simple +" + spcd_step "Create" + "${SPCD_PYTHON_ALIAS}" -m "venv" "${SPCD_PYTHON_VENV}" + spcd_step "Activate" + export PATH="${SPCD_PYTHON_VENV_BINARIES}:${PATH}" + export VIRTUAL_ENV="${SPCD_PYTHON_VENV}" + spcd_step_out +} + spcd_f_py_link() { local command="${1}" if [ -n "${command}" ]; then @@ -1426,33 +1453,6 @@ spcd_step__packages_install_git() { # │ s │ python │ # ╰───┴────────╯ -spcd_step__python_install() { - spcd_step "Install package" - spcd_f_pm_pkg_install "${SPCD_PYTHON_PACKAGE}" - spcd_step "Link alias to command" - spcd_f_py_link "${SPCD_PYTHON_COMMAND}" - # venv - spcd_step_in "Virtual environment" - spcd_step "Install package" - case "${SPCD_OS_ID}" in - "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") - spcd_f_pm_pkg_install "python3-venv" - ;; - *) ;; - esac - spcd_step "Configure PIP" - spcd_os_write "/etc/pip.conf" "\ -[global] -index-url = ${SPCD_URL_PYTHON}/simple -" - spcd_step "Create" - "${SPCD_PYTHON_ALIAS}" -m "venv" "${SPCD_PYTHON_VENV}" - spcd_step "Activate" - export PATH="${SPCD_PYTHON_VENV_BINARIES}:${PATH}" - export VIRTUAL_ENV="${SPCD_PYTHON_VENV}" - spcd_step_out -} - spcd_step__python_modules() { spcd_step_in "Modules" local target path script check @@ -1614,7 +1614,7 @@ spcd_main() { spcd_step_out # python spcd_step_in "Python" - spcd_step__python_install + spcd_f_py_install spcd_step__python_modules spcd_step__install_packages spcd_f_py_save