diff options
author | Chuck Lantz <clantz@microsoft.com> | 2022-11-11 04:03:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-11 04:03:21 +0300 |
commit | f7f05f76fabda70f4fbcaefd55e6fe6fd09a8145 (patch) | |
tree | dad962871b8c028d8cd7f90fe5ed54bac164c43a /src/python | |
parent | 3020d6da64798ee994d407ffd3ce3f800f6dff92 (diff) |
Fix regression with Azure CLI, privs (#272)
Diffstat (limited to 'src/python')
-rw-r--r-- | src/python/devcontainer-feature.json | 2 | ||||
-rwxr-xr-x | src/python/install.sh | 32 |
2 files changed, 21 insertions, 13 deletions
diff --git a/src/python/devcontainer-feature.json b/src/python/devcontainer-feature.json index 8f8faae..d6fa9bc 100644 --- a/src/python/devcontainer-feature.json +++ b/src/python/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "python", - "version": "1.0.11", + "version": "1.0.12", "name": "Python", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/python", "description": "Installs the provided version of Python, as well as PIPX, and other common Python utilities. JupyterLab is conditionally installed with the python feature. Note: May require source code compilation.", diff --git a/src/python/install.sh b/src/python/install.sh index de1b0e6..e54387e 100755 --- a/src/python/install.sh +++ b/src/python/install.sh @@ -340,17 +340,24 @@ add_user_jupyter_config() { install_python() { version=$1 # If the os-provided versions are "good enough", detect that and bail out. - if [ ${PYTHON_VERSION} = "os-provided" ] || [ ${PYTHON_VERSION} = "system" ]; then + if [ ${version} = "os-provided" ] || [ ${version} = "system" ]; then check_packages python3 python3-doc python3-pip python3-venv python3-dev python3-tk INSTALL_PATH="/usr" - ln -s "${INSTALL_PATH}/bin/python3" "${INSTALL_PATH}/bin/python" - ln -s "${INSTALL_PATH}/bin/pydoc3" "${INSTALL_PATH}/bin/pydoc" - ln -s "${INSTALL_PATH}/bin/python3-config" "${INSTALL_PATH}/bin/python-config" - - # Add the current symlink but point it to "/usr" since python is at /usr/bin/python - mkdir -p "${PYTHON_INSTALL_PATH}" - add_symlink + local current_bin_path="${CURRENT_PATH}/bin" + if [ "${OVERRIDE_DEFAULT_VERSION}" = "true" ]; then + rm -rf "${current_bin_path}" + fi + if [ ! -d "${current_bin_path}" ] ; then + mkdir -p "${current_bin_path}" + # Add an interpreter symlink but point it to "/usr" since python is at /usr/bin/python, add other alises + ln -s "${INSTALL_PATH}/bin/python3" "${current_bin_path}/python3" + ln -s "${INSTALL_PATH}/bin/python3" "${current_bin_path}/python" + ln -s "${INSTALL_PATH}/bin/pydoc3" "${current_bin_path}/pydoc3" + ln -s "${INSTALL_PATH}/bin/pydoc3" "${current_bin_path}/pydoc" + ln -s "${INSTALL_PATH}/bin/python3-config" "${current_bin_path}/python3-config" + ln -s "${INSTALL_PATH}/bin/python3-config" "${current_bin_path}/python-config" + fi should_install_from_source=false elif [ "$(dpkg --print-architecture)" = "amd64" ] && [ "${USE_ORYX_IF_AVAILABLE}" = "true" ] && type oryx > /dev/null 2>&1; then @@ -399,12 +406,13 @@ if [ "${PYTHON_VERSION}" != "none" ]; then if [ ${PYTHON_VERSION} != "os-provided" ] && [ ${PYTHON_VERSION} != "system" ]; then updaterc "if [[ \"\${PATH}\" != *\"${CURRENT_PATH}/bin\"* ]]; then export PATH=${CURRENT_PATH}/bin:\${PATH}; fi" - chown -R "${USERNAME}:python" "${PYTHON_INSTALL_PATH}" - chmod -R g+r+w "${PYTHON_INSTALL_PATH}" - find "${PYTHON_INSTALL_PATH}" -type d -print0 | xargs -0 -n 1 chmod g+s - PATH="${INSTALL_PATH}/bin:${PATH}" fi + + # Updates the symlinks for os-provided, or the installed python version in other cases + chown -R "${USERNAME}:python" "${PYTHON_INSTALL_PATH}" + chmod -R g+r+w "${PYTHON_INSTALL_PATH}" + find "${PYTHON_INSTALL_PATH}" -type d -print0 | xargs -0 -n 1 chmod g+s fi # Install Python tools if needed |