diff options
author | Samruddhi Khandale <skhandale@microsoft.com> | 2022-05-12 00:48:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-12 00:48:13 +0300 |
commit | 9ec1eacf025434422bb7ab2d41addc6d66e22458 (patch) | |
tree | 800875c332f692c254ec36bbc992969a21a1a4cf /collection/python/install.sh | |
parent | d9c4c137e1bbff48328900fceb556fa13cff2b80 (diff) |
python: copying original contents of install.sh (#9)
python: copying orignal
Diffstat (limited to 'collection/python/install.sh')
-rw-r--r-- | collection/python/install.sh | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/collection/python/install.sh b/collection/python/install.sh index 3a2d429..bdfc4d8 100644 --- a/collection/python/install.sh +++ b/collection/python/install.sh @@ -1,11 +1,16 @@ #!/usr/bin/env bash - -PYTHON_VERSION=($PYTHON_VERSION) # 'system' checks the base image first, else installs 'latest' -PYTHON_INSTALL_PATH=($PYTHON_INSTALL_PATH) -PYTHON_SETUP_LINKS=($PYTHON_SETUP_LINKS) - -#PYTHON_VERSION=${1:-"latest"} # 'system' checks the base image first, else installs 'latest' -#PYTHON_INSTALL_PATH=${2:-"/usr/local/python"} +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- +# +# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/python.md +# Maintainer: The VS Code and Codespaces Teams +# +# Syntax: ./python-debian.sh [Python Version] [Python intall path] [PIPX_HOME] [non-root user] [Update rc files flag] [install tools flag] [Use Oryx if available flag] [Optimize when building from source flag] + +PYTHON_VERSION=${1:-"latest"} # 'system' checks the base image first, else installs 'latest' +PYTHON_INSTALL_PATH=${2:-"/usr/local/python"} export PIPX_HOME=${3:-"/usr/local/py-utils"} USERNAME=${4:-"automatic"} UPDATE_RC=${5:-"true"} @@ -341,36 +346,9 @@ for util in ${DEFAULT_UTILS[@]}; do done rm -rf /tmp/pip-tmp -echo "(*) Updating RC files." - updaterc "$(cat << EOF export PIPX_HOME="${PIPX_HOME}" export PIPX_BIN_DIR="${PIPX_BIN_DIR}" if [[ "\${PATH}" != *"\${PIPX_BIN_DIR}"* ]]; then export PATH="\${PATH}:\${PIPX_BIN_DIR}"; fi EOF )" - -echo "(*) About to do final Python setup." - -INSTALLED_PYTHON_VERSION=$(${PYTHON_INSTALL_PATH}/bin/python --version 2>&1 | grep -Po '(?<=Python )(.+)') -if [[ ! -z "$INSTALLED_PYTHON_VERSION" ]] ; then - echo "(*) Installed Python version is ${INSTALLED_PYTHON_VERSION}" - PYTHON_MAJOR_VERSION=$(echo ${INSTALLED_PYTHON_VERSION} | cut -f1 -d'.') - PYTHON_MINOR_VERSION=$(echo ${INSTALLED_PYTHON_VERSION} | cut -f2 -d'.') - - if [ "${PYTHON_SETUP_LINKS}" = "true" ]; then - mkdir -p /opt/python - ln -s /usr/share/python /opt/python/${INSTALLED_PYTHON_VERSION} - ln -s /opt/python/${INSTALLED_PYTHON_VERSION} /opt/python/${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION} - ln -s /opt/python/${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION} /opt/python/${PYTHON_MAJOR_VERSION} - ln -s /opt/python/${INSTALLED_PYTHON_VERSION} /opt/python/latest - ln -s /opt/python/${INSTALLED_PYTHON_VERSION} /opt/python/stable - - mkdir -p /home/${USERNAME}/.python - ln -s /opt/python/${INSTALLED_PYTHON_VERSION} /home/${USERNAME}/.python/current - fi -else - echo "(*) Failed to get installed Python version." -fi - -echo "(*) Done with Python feature." |