Fix bug - Python: Error installing os-provided python (#112)
* python: fix bug * bump versions
This commit is contained in:
parent
0cafeee862
commit
84f4996643
22 changed files with 63 additions and 34 deletions
2
.github/workflows/test-all.yaml
vendored
2
.github/workflows/test-all.yaml
vendored
|
@ -43,7 +43,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
|
||||
- name: "Install latest devcontainer CLI"
|
||||
run: npm install -g @devcontainers/cli
|
||||
run: npm install -g @devcontainers/cli@0.12.1
|
||||
|
||||
- name: " Testing '${{ matrix.features }}' against '${{ matrix.baseImage }}'"
|
||||
run: devcontainer features test -f ${{ matrix.features }} -i ${{ matrix.baseImage }} -c `pwd`
|
||||
|
|
2
.github/workflows/test-manual.yaml
vendored
2
.github/workflows/test-manual.yaml
vendored
|
@ -22,7 +22,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
|
||||
- name: "Install latest devcontainer CLI"
|
||||
run: npm install -g @devcontainers/cli
|
||||
run: npm install -g @devcontainers/cli@0.12.1
|
||||
|
||||
- name: "Testing '${{ github.event.inputs.features }}' against '${{ github.event.inputs.baseImage }}'"
|
||||
run: devcontainer features test --features ${{ github.event.inputs.features }} --base-image ${{ github.event.inputs.baseImage }} --collection-folder `pwd` --log-level ${{ github.event.inputs.logLevel }}
|
||||
|
|
2
.github/workflows/test-pr.yaml
vendored
2
.github/workflows/test-pr.yaml
vendored
|
@ -57,7 +57,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
|
||||
- name: "Install latest devcontainer CLI"
|
||||
run: npm install -g @devcontainers/cli
|
||||
run: npm install -g @devcontainers/cli@0.12.1
|
||||
|
||||
- name: "Testing '${{ matrix.features }}' against '${{ matrix.baseImage }}'"
|
||||
run: devcontainer features test -f ${{ matrix.features }} -i ${{ matrix.baseImage }} -c `pwd`
|
||||
|
|
2
.github/workflows/test-scenarios.yaml
vendored
2
.github/workflows/test-scenarios.yaml
vendored
|
@ -13,7 +13,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
|
||||
- name: "Install latest devcontainer CLI"
|
||||
run: npm install -g @devcontainers/cli
|
||||
run: npm install -g @devcontainers/cli@0.12.1
|
||||
|
||||
- name: "Running predefined test scenarios"
|
||||
run: devcontainer features test --scenarios `pwd`/test-scenarios -c `pwd`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "anaconda",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"name": "Anaconda",
|
||||
"options": {
|
||||
"version": {
|
||||
|
|
|
@ -83,7 +83,7 @@ if ! conda --version &> /dev/null ; then
|
|||
chown -R "${USERNAME}:conda" "${CONDA_DIR}"
|
||||
chmod -R g+r+w "${CONDA_DIR}"
|
||||
|
||||
find "${CONDA_DIR}" -type d | xargs -n 1 chmod g+s
|
||||
find "${CONDA_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
|
||||
echo "Installing Anaconda..."
|
||||
|
||||
CONDA_VERSION=$VERSION
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "dotnet",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"name": "Dotnet CLI",
|
||||
"description": "Installs the .NET CLI. Provides option of installing sdk or runtime, and option of versions to install. Uses latest version of .NET sdk as defaults to install.",
|
||||
"options": {
|
||||
|
|
|
@ -230,7 +230,7 @@ install_using_apt_from_microsoft_repo() {
|
|||
install_using_default_apt_repo() {
|
||||
DOTNET_PACKAGE="dotnet6"
|
||||
|
||||
apt_get_update_if_needed
|
||||
apt_get_update
|
||||
|
||||
if [[ "${DOTNET_VERSION}" = "latest" ]] || [[ "${DOTNET_VERSION}" = "lts" ]] || [[ ${DOTNET_VERSION} = "6"* ]]; then
|
||||
if ! (apt-get install -yq ${DOTNET_PACKAGE}); then
|
||||
|
@ -460,7 +460,7 @@ if [ "${CHANGE_OWNERSHIP}" = "true" ]; then
|
|||
|
||||
chown -R "${USERNAME}:dotnet" "${TARGET_DOTNET_ROOT}"
|
||||
chmod -R g+r+w "${TARGET_DOTNET_ROOT}"
|
||||
find "${TARGET_DOTNET_ROOT}" -type d | xargs -n 1 chmod g+s
|
||||
find "${TARGET_DOTNET_ROOT}" -type d -print0 | xargs -n 1 -0 chmod g+s
|
||||
fi
|
||||
|
||||
echo "Done!"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "go",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"name": "Go",
|
||||
"description": "Installs Go and common Go utilities. Auto-detects latest version and installs needed dependencies.",
|
||||
"options": {
|
||||
|
|
|
@ -242,8 +242,8 @@ EOF
|
|||
|
||||
chown -R "${USERNAME}:golang" "${TARGET_GOROOT}" "${TARGET_GOPATH}"
|
||||
chmod -R g+r+w "${TARGET_GOROOT}" "${TARGET_GOPATH}"
|
||||
find "${TARGET_GOROOT}" -type d | xargs -n 1 chmod g+s
|
||||
find "${TARGET_GOPATH}" -type d | xargs -n 1 chmod g+s
|
||||
find "${TARGET_GOROOT}" -type d -print0 | xargs -n 1 -0 chmod g+s
|
||||
find "${TARGET_GOPATH}" -type d -print0 | xargs -n 1 -0 chmod g+s
|
||||
|
||||
echo "Done!"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "hugo",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"name": "Hugo",
|
||||
"options": {
|
||||
"version": {
|
||||
|
|
|
@ -111,7 +111,7 @@ if ! hugo version &> /dev/null ; then
|
|||
|
||||
chown -R "${USERNAME}:hugo" "${HUGO_DIR}"
|
||||
chmod -R g+r+w "${HUGO_DIR}"
|
||||
find "${HUGO_DIR}" -type d | xargs -n 1 chmod g+s
|
||||
find "${HUGO_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
|
||||
fi
|
||||
|
||||
echo "Done!"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "java",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"name": "Java (via SDKMAN!)",
|
||||
"description": "Installs Java, SDKMAN! (if not installed), and needed dependencies.",
|
||||
"options": {
|
||||
|
|
|
@ -143,7 +143,7 @@ if [ ! -d "${SDKMAN_DIR}" ]; then
|
|||
# Install SDKMAN
|
||||
curl -sSL "https://get.sdkman.io?rcupdate=false" | bash
|
||||
chown -R "${USERNAME}:sdkman" ${SDKMAN_DIR}
|
||||
find ${SDKMAN_DIR} -type d | xargs -d '\n' chmod g+s
|
||||
find ${SDKMAN_DIR} -type d -print0 | xargs -d '\n' -0 chmod g+s
|
||||
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\n. \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "oryx",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"name": "Oryx",
|
||||
"description": "Installs the oryx CLI",
|
||||
"containerEnv": {
|
||||
|
|
|
@ -142,8 +142,8 @@ updaterc "export ORYX_SDK_STORAGE_BASE_URL=https://oryx-cdn.microsoft.io && expo
|
|||
|
||||
chown -R "${USERNAME}:oryx" "${ORYX_INSTALL_DIR}" "${BUILD_SCRIPT_GENERATOR}" "${ORYX}"
|
||||
chmod -R g+r+w "${ORYX_INSTALL_DIR}" "${BUILD_SCRIPT_GENERATOR}" "${ORYX}"
|
||||
find "${ORYX_INSTALL_DIR}" -type d | xargs -n 1 chmod g+s
|
||||
find "${BUILD_SCRIPT_GENERATOR}" -type d | xargs -n 1 chmod g+s
|
||||
find "${ORYX}" -type d | xargs -n 1 chmod g+s
|
||||
find "${ORYX_INSTALL_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
|
||||
find "${BUILD_SCRIPT_GENERATOR}" -type d -print0 | xargs -n 1 -0 chmod g+s
|
||||
find "${ORYX}" -type d -print0 | xargs -n 1 -0 chmod g+s
|
||||
|
||||
echo "Done!"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "php",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"name": "PHP",
|
||||
"options": {
|
||||
"version": {
|
||||
|
|
|
@ -220,6 +220,6 @@ fi
|
|||
|
||||
chown -R "${USERNAME}:php" "${PHP_DIR}"
|
||||
chmod -R g+r+w "${PHP_DIR}"
|
||||
find "${PHP_DIR}" -type d | xargs -n 1 chmod g+s
|
||||
find "${PHP_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
|
||||
|
||||
echo "Done!"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "python",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"name": "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.",
|
||||
"options": {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
PYTHON_VERSION=${VERSION:-"latest"} # 'system' checks the base image first, else installs 'latest'
|
||||
INSTALL_PYTHON_TOOLS=${INSTALLTOOLS:-"true"}
|
||||
OPTIMIZE_BUILD_FROM_SOURCE=${OPTIMIZE:-"false"}
|
||||
PYTHON_INSTALL_PATH=${INSTALL_PATH:-"/usr/local/python"}
|
||||
PYTHON_INSTALL_PATH=${INSTALLPATH:-"/usr/local/python"}
|
||||
OVERRIDE_DEFAULT_VERSION=${OVERRIDEDEFAULTVERSION:-"true"}
|
||||
|
||||
export PIPX_HOME=${PIPX_HOME:-"/usr/local/py-utils"}
|
||||
|
@ -335,7 +335,12 @@ install_python() {
|
|||
# If the os-provided versions are "good enough", detect that and bail out.
|
||||
if [ ${PYTHON_VERSION} = "os-provided" ] || [ ${PYTHON_VERSION} = "system" ]; then
|
||||
check_packages python3 python3-doc python3-pip python3-venv python3-dev python3-tk
|
||||
PYTHON_INSTALL_PATH="/usr"
|
||||
PYTHON_ROOT="/usr/bin"
|
||||
|
||||
ln -s "${PYTHON_ROOT}/python3" "${PYTHON_ROOT}/python"
|
||||
ln -s "${PYTHON_ROOT}/pydoc3" "${PYTHON_ROOT}/pydoc"
|
||||
ln -s "${PYTHON_ROOT}/python3-config" "${PYTHON_ROOT}/python-config"
|
||||
|
||||
should_install_from_source=false
|
||||
elif [ "$(dpkg --print-architecture)" = "amd64" ] && [ "${USE_ORYX_IF_AVAILABLE}" = "true" ] && type oryx > /dev/null 2>&1; then
|
||||
install_using_oryx $version || should_install_from_source=true
|
||||
|
@ -366,9 +371,7 @@ if [ "${PYTHON_VERSION}" != "none" ]; then
|
|||
CURRENT_PATH="${PYTHON_INSTALL_PATH}/current"
|
||||
|
||||
install_python ${PYTHON_VERSION}
|
||||
|
||||
updaterc "if [[ \"\${PATH}\" != *\"${CURRENT_PATH}/bin\"* ]]; then export PATH=${CURRENT_PATH}/bin:\${PATH}; fi"
|
||||
|
||||
|
||||
# Additional python versions to be installed but not be set as default.
|
||||
if [ ! -z "${ADDITIONAL_VERSIONS}" ]; then
|
||||
OLDIFS=$IFS
|
||||
|
@ -381,11 +384,14 @@ if [ "${PYTHON_VERSION}" != "none" ]; then
|
|||
IFS=$OLDIFS
|
||||
fi
|
||||
|
||||
chown -R "${USERNAME}:python" "${PYTHON_INSTALL_PATH}"
|
||||
chmod -R g+r+w "${PYTHON_INSTALL_PATH}"
|
||||
find "${PYTHON_INSTALL_PATH}" -type d | xargs -n 1 chmod g+s
|
||||
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}"
|
||||
PATH="${INSTALL_PATH}/bin:${PATH}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install Python tools if needed
|
||||
|
@ -403,7 +409,7 @@ if [[ "${INSTALL_PYTHON_TOOLS}" = "true" ]] && [[ $(python --version) != "" ]];
|
|||
mkdir -p ${PIPX_BIN_DIR}
|
||||
chown -R "${USERNAME}:pipx" ${PIPX_HOME}
|
||||
chmod -R g+r+w "${PIPX_HOME}"
|
||||
find "${PIPX_HOME}" -type d | xargs -n 1 chmod g+s
|
||||
find "${PIPX_HOME}" -type d -print0 | xargs -0 -n 1 chmod g+s
|
||||
|
||||
# Update pip if not using os provided python
|
||||
if [[ $(python --version) != "" ]] || [[ ${PYTHON_VERSION} != "os-provided" ]] && [[ ${PYTHON_VERSION} != "system" ]] && [[ ${PYTHON_VERSION} != "none" ]]; then
|
||||
|
|
16
test-scenarios/install_os_provided_python.sh
Normal file
16
test-scenarios/install_os_provided_python.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Optional: Import test library
|
||||
source dev-container-features-test-lib
|
||||
|
||||
check "python3 is installed" python3 --version
|
||||
check "python is installed" python --version
|
||||
check "pip is installed" pip --version
|
||||
check "pip is installed" pip3 --version
|
||||
|
||||
check "node is installed" node --version
|
||||
|
||||
# Report result
|
||||
reportResults
|
|
@ -1,4 +1,11 @@
|
|||
{
|
||||
"install_os_provided_python": {
|
||||
"image": "mcr.microsoft.com/devcontainers/base:0-bullseye",
|
||||
"features": {
|
||||
"node": "latest",
|
||||
"python": "os-provided"
|
||||
}
|
||||
},
|
||||
"install_gradle_and_maven": {
|
||||
"image": "ubuntu:focal",
|
||||
"features": {
|
||||
|
@ -28,7 +35,7 @@
|
|||
}
|
||||
},
|
||||
"install_jupyterlab": {
|
||||
"image": "mcr.microsoft.com/vscode/devcontainers/base:focal",
|
||||
"image": "mcr.microsoft.com/devcontainers/base:focal",
|
||||
"remoteUser": "vscode",
|
||||
"features": {
|
||||
"common-utils": {
|
||||
|
|
Loading…
Reference in a new issue