aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamruddhi Khandale <skhandale@microsoft.com>2022-09-08 23:30:57 +0300
committerSamruddhi Khandale <skhandale@microsoft.com>2022-09-08 23:30:57 +0300
commitdd737d12e1f28906243bf3900a8a2787508afa57 (patch)
treecc32d7c37bd4af961bcc00396840e7feb7270b61
parent723b2ea168cf42c4a3c00789b92c726b5a021182 (diff)
address comments
-rwxr-xr-xsrc/python/install.sh22
-rw-r--r--test/python/install_jupyterlab_2.sh11
-rw-r--r--test/python/install_os_provided_python.sh1
-rw-r--r--test/python/scenarios.json23
4 files changed, 48 insertions, 9 deletions
diff --git a/src/python/install.sh b/src/python/install.sh
index 414b0d9..8cf7043 100755
--- a/src/python/install.sh
+++ b/src/python/install.sh
@@ -315,7 +315,9 @@ sudo_if() {
install_user_package() {
PACKAGE="$1"
- sudo_if "$CURRENT_PATH/bin/python" -m pip install --upgrade --no-cache-dir "$PACKAGE"
+ PYTHON_ROOT=$(which python3)
+
+ sudo_if "$PYTHON_ROOT" -m pip install --upgrade --no-cache-dir "$PACKAGE"
}
add_user_jupyter_config() {
@@ -391,8 +393,9 @@ if [ "${PYTHON_VERSION}" != "none" ]; then
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
+
+ export PATH="${CURRENT_PATH}/bin:${PATH}"
fi
# Install Python tools if needed
@@ -444,12 +447,17 @@ fi
# Install JupyterLab if needed
if [ "${INSTALL_JUPYTERLAB}" = "true" ]; then
- install_user_package jupyterlab
+ if [[ $(python --version) != "" ]]; then
+ install_user_package jupyterlab
- # Configure JupyterLab if needed
- if [ -n "${CONFIGURE_JUPYTERLAB_ALLOW_ORIGIN}" ]; then
- add_user_jupyter_config "c.ServerApp.allow_origin = '${CONFIGURE_JUPYTERLAB_ALLOW_ORIGIN}'"
- add_user_jupyter_config "c.NotebookApp.allow_origin = '${CONFIGURE_JUPYTERLAB_ALLOW_ORIGIN}'"
+ # Configure JupyterLab if needed
+ if [ -n "${CONFIGURE_JUPYTERLAB_ALLOW_ORIGIN}" ]; then
+ add_user_jupyter_config "c.ServerApp.allow_origin = '${CONFIGURE_JUPYTERLAB_ALLOW_ORIGIN}'"
+ add_user_jupyter_config "c.NotebookApp.allow_origin = '${CONFIGURE_JUPYTERLAB_ALLOW_ORIGIN}'"
+ fi
+ else
+ echo "(!) Could not install jupyterlab. Make sure you have python installed."
+ exit 1
fi
fi
diff --git a/test/python/install_jupyterlab_2.sh b/test/python/install_jupyterlab_2.sh
new file mode 100644
index 0000000..cdf6705
--- /dev/null
+++ b/test/python/install_jupyterlab_2.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+check "jupyter lab version" jupyter lab --version
+
+# Report result
+reportResults
diff --git a/test/python/install_os_provided_python.sh b/test/python/install_os_provided_python.sh
index 50a617e..3c4a8f6 100644
--- a/test/python/install_os_provided_python.sh
+++ b/test/python/install_os_provided_python.sh
@@ -9,6 +9,7 @@ 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 "jupyter lab version" jupyter lab --version
check "node is installed" node --version
diff --git a/test/python/scenarios.json b/test/python/scenarios.json
index 2aa246f..561d8f6 100644
--- a/test/python/scenarios.json
+++ b/test/python/scenarios.json
@@ -1,4 +1,18 @@
{
+ "install_jupyterlab_2": {
+ "image": "mcr.microsoft.com/vscode/devcontainers/python:latest",
+ "remoteUser": "vscode",
+ "features": {
+ "common-utils": {
+ "username": "vscode"
+ },
+ "python": {
+ "version": "none",
+ "installJupyterlab": true,
+ "configureJupyterlabAllowOrigin": "*"
+ }
+ }
+ },
"install_additional_python": {
"image": "ubuntu:focal",
"features": {
@@ -16,6 +30,7 @@
"username": "vscode"
},
"python": {
+ "version": "latest",
"installJupyterlab": true,
"configureJupyterlabAllowOrigin": "*"
}
@@ -25,7 +40,11 @@
"image": "mcr.microsoft.com/devcontainers/base:0-bullseye",
"features": {
"node": "latest",
- "python": "os-provided"
+ "python": {
+ "version": "os-provided",
+ "installJupyterlab": true,
+ "configureJupyterlabAllowOrigin": "*"
+ }
}
}
-} \ No newline at end of file
+}