aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamruddhi Khandale <skhandale@microsoft.com>2022-08-23 23:13:33 +0300
committerGitHub <noreply@github.com>2022-08-23 23:13:33 +0300
commit84f4996643b84c6f3dcd5c3edc72ae176dceaf65 (patch)
tree74b7eddfc24ae22409baf5f3e4be28ce52d5881a
parent0cafeee86296b9f19e6425055e0c4037eff41985 (diff)
Fix bug - Python: Error installing os-provided python (#112)
* python: fix bug * bump versions
-rw-r--r--.github/workflows/test-all.yaml2
-rw-r--r--.github/workflows/test-manual.yaml2
-rw-r--r--.github/workflows/test-pr.yaml2
-rw-r--r--.github/workflows/test-scenarios.yaml2
-rw-r--r--src/anaconda/devcontainer-feature.json2
-rwxr-xr-xsrc/anaconda/install.sh2
-rw-r--r--src/dotnet/devcontainer-feature.json2
-rwxr-xr-xsrc/dotnet/install.sh4
-rw-r--r--src/go/devcontainer-feature.json2
-rwxr-xr-xsrc/go/install.sh4
-rw-r--r--src/hugo/devcontainer-feature.json2
-rwxr-xr-xsrc/hugo/install.sh2
-rw-r--r--src/java/devcontainer-feature.json2
-rwxr-xr-xsrc/java/install.sh2
-rw-r--r--src/oryx/devcontainer-feature.json2
-rwxr-xr-xsrc/oryx/install.sh6
-rw-r--r--src/php/devcontainer-feature.json2
-rwxr-xr-xsrc/php/install.sh2
-rw-r--r--src/python/devcontainer-feature.json2
-rwxr-xr-xsrc/python/install.sh26
-rw-r--r--test-scenarios/install_os_provided_python.sh16
-rw-r--r--test-scenarios/scenarios.json9
22 files changed, 63 insertions, 34 deletions
diff --git a/.github/workflows/test-all.yaml b/.github/workflows/test-all.yaml
index 644a4ec..6b453f8 100644
--- a/.github/workflows/test-all.yaml
+++ b/.github/workflows/test-all.yaml
@@ -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`
diff --git a/.github/workflows/test-manual.yaml b/.github/workflows/test-manual.yaml
index f1ac2d4..3e285a7 100644
--- a/.github/workflows/test-manual.yaml
+++ b/.github/workflows/test-manual.yaml
@@ -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 }}
diff --git a/.github/workflows/test-pr.yaml b/.github/workflows/test-pr.yaml
index b960039..7624701 100644
--- a/.github/workflows/test-pr.yaml
+++ b/.github/workflows/test-pr.yaml
@@ -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`
diff --git a/.github/workflows/test-scenarios.yaml b/.github/workflows/test-scenarios.yaml
index 1fc90d5..cc71737 100644
--- a/.github/workflows/test-scenarios.yaml
+++ b/.github/workflows/test-scenarios.yaml
@@ -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`
diff --git a/src/anaconda/devcontainer-feature.json b/src/anaconda/devcontainer-feature.json
index 98e916c..7d2f2ed 100644
--- a/src/anaconda/devcontainer-feature.json
+++ b/src/anaconda/devcontainer-feature.json
@@ -1,6 +1,6 @@
{
"id": "anaconda",
- "version": "1.0.0",
+ "version": "1.0.1",
"name": "Anaconda",
"options": {
"version": {
diff --git a/src/anaconda/install.sh b/src/anaconda/install.sh
index 9e7042a..1802ce3 100755
--- a/src/anaconda/install.sh
+++ b/src/anaconda/install.sh
@@ -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
diff --git a/src/dotnet/devcontainer-feature.json b/src/dotnet/devcontainer-feature.json
index 4c6f9d5..b7aecaa 100644
--- a/src/dotnet/devcontainer-feature.json
+++ b/src/dotnet/devcontainer-feature.json
@@ -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": {
diff --git a/src/dotnet/install.sh b/src/dotnet/install.sh
index f8231ac..d9399ca 100755
--- a/src/dotnet/install.sh
+++ b/src/dotnet/install.sh
@@ -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!"
diff --git a/src/go/devcontainer-feature.json b/src/go/devcontainer-feature.json
index a0f37df..d2419b9 100644
--- a/src/go/devcontainer-feature.json
+++ b/src/go/devcontainer-feature.json
@@ -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": {
diff --git a/src/go/install.sh b/src/go/install.sh
index e50c024..3b0ff26 100755
--- a/src/go/install.sh
+++ b/src/go/install.sh
@@ -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!"
diff --git a/src/hugo/devcontainer-feature.json b/src/hugo/devcontainer-feature.json
index b55c737..27d2d08 100644
--- a/src/hugo/devcontainer-feature.json
+++ b/src/hugo/devcontainer-feature.json
@@ -1,6 +1,6 @@
{
"id": "hugo",
- "version": "1.0.0",
+ "version": "1.0.1",
"name": "Hugo",
"options": {
"version": {
diff --git a/src/hugo/install.sh b/src/hugo/install.sh
index 0ccc294..62c0724 100755
--- a/src/hugo/install.sh
+++ b/src/hugo/install.sh
@@ -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!"
diff --git a/src/java/devcontainer-feature.json b/src/java/devcontainer-feature.json
index a67ca2f..5906e6a 100644
--- a/src/java/devcontainer-feature.json
+++ b/src/java/devcontainer-feature.json
@@ -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": {
diff --git a/src/java/install.sh b/src/java/install.sh
index 03cf2f2..1ff3a67 100755
--- a/src/java/install.sh
+++ b/src/java/install.sh
@@ -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
diff --git a/src/oryx/devcontainer-feature.json b/src/oryx/devcontainer-feature.json
index 0ebd68a..a70af42 100644
--- a/src/oryx/devcontainer-feature.json
+++ b/src/oryx/devcontainer-feature.json
@@ -1,6 +1,6 @@
{
"id": "oryx",
- "version": "1.0.0",
+ "version": "1.0.1",
"name": "Oryx",
"description": "Installs the oryx CLI",
"containerEnv": {
diff --git a/src/oryx/install.sh b/src/oryx/install.sh
index 342a723..c011c65 100755
--- a/src/oryx/install.sh
+++ b/src/oryx/install.sh
@@ -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!"
diff --git a/src/php/devcontainer-feature.json b/src/php/devcontainer-feature.json
index 21089a5..305914a 100644
--- a/src/php/devcontainer-feature.json
+++ b/src/php/devcontainer-feature.json
@@ -1,6 +1,6 @@
{
"id": "php",
- "version": "1.0.2",
+ "version": "1.0.3",
"name": "PHP",
"options": {
"version": {
diff --git a/src/php/install.sh b/src/php/install.sh
index 0807fb7..fdc374a 100755
--- a/src/php/install.sh
+++ b/src/php/install.sh
@@ -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!"
diff --git a/src/python/devcontainer-feature.json b/src/python/devcontainer-feature.json
index 329d85a..6f31f83 100644
--- a/src/python/devcontainer-feature.json
+++ b/src/python/devcontainer-feature.json
@@ -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": {
diff --git a/src/python/install.sh b/src/python/install.sh
index b1a75d9..08465dc 100755
--- a/src/python/install.sh
+++ b/src/python/install.sh
@@ -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
diff --git a/test-scenarios/install_os_provided_python.sh b/test-scenarios/install_os_provided_python.sh
new file mode 100644
index 0000000..4dba59d
--- /dev/null
+++ b/test-scenarios/install_os_provided_python.sh
@@ -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
diff --git a/test-scenarios/scenarios.json b/test-scenarios/scenarios.json
index c7ec8af..ddf15d0 100644
--- a/test-scenarios/scenarios.json
+++ b/test-scenarios/scenarios.json
@@ -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": {