From 907eb6198b36b69e8a9597069c0e67a1e66d20b0 Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Fri, 25 Jan 2019 12:35:45 +0000 Subject: [PATCH 1/4] vagrant: use a dedicated venv within a VM This is to ensure that the VM can't clobber the host installation. Signed-off-by: Patrick Bellasi --- Vagrantfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index 6ef3dd794..a5061cbc7 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -26,12 +26,17 @@ Vagrant.configure(2) do |config| chown -R vagrant.vagrant /home/vagrant/lisa + # Let' use a venv local to vagrant so that we don't pollute the host one. + # This allows to use LISA both from the host and the VM. + export LISA_VENV_PATH=/home/vagrant/venv + # .bashrc setup echo "cd /home/vagrant/lisa" >> /home/vagrant/.bashrc for LC in $(locale | cut -d= -f1); do echo unset $LC >> /home/vagrant/.bashrc done + echo 'export LISA_VENV_PATH=$LISA_VENV_PATH' >> /home/vagrant/.bashrc echo 'source init_env' >> /home/vagrant/.bashrc # Trigger the creation of a venv -- GitLab From af86df52f6fb024a88b14e9da933a3474cfbdfaf Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Thu, 24 Jan 2019 15:15:31 +0000 Subject: [PATCH 2/4] shell: ensure we always use a fresh shell When env variables are changed it could happen that initializing lisa from a preconfigured environment misses required steps or wrongly assume some configurations have been already don. Let's fix it by forcing users to always start LISA from a fresh shell. Signed-off-by: Patrick Bellasi --- .travis.yml | 2 +- init_env | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3b53acd78..c9c170e8b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,4 +32,4 @@ install: script: - cd "$TRAVIS_BUILD_DIR" - - bash ./tools/scripts/travis_tests.sh + - env -i bash ./tools/scripts/travis_tests.sh diff --git a/init_env b/init_env index e908781db..d054389a8 100644 --- a/init_env +++ b/init_env @@ -20,6 +20,14 @@ _lisa_shell_ret=1 +# Ensure we aleays start from a clean new shell +if [[ -n $LISA_HOME ]]; then + echo + echo "ERROR: Please source init_env from a fresh new shell." + echo + return +fi + setup_paths() { # Bail out if local tools are not installed [[ -d $LISA_HOME/tools/android-sdk-linux ]] || return -- GitLab From efea304af988cdce9351c415b566f17bf36d277d Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Mon, 14 Jan 2019 14:55:32 +0000 Subject: [PATCH 3/4] shell: add ipywidgets support JupyterLab's ipywidgets allows to create interactive plots: https://github.com/jupyter-widgets/ipywidgets This adds the required support to the LISA shell to properly configure and enable the support. The ipywidgets extensions are enabled at lisa-install time only if the nodejs dependency is satisfied. Signed-off-by: Patrick Bellasi --- install_base_ubuntu.sh | 13 +++++++++++++ setup.py | 3 ++- shell/lisa_shell | 30 +++++++++++++++++++++++++++--- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/install_base_ubuntu.sh b/install_base_ubuntu.sh index ada155377..16385662d 100755 --- a/install_base_ubuntu.sh +++ b/install_base_ubuntu.sh @@ -42,6 +42,16 @@ install_sdk() { fi } +install_nodejs() { + # NodeJS v8+ is required, Ubuntu 16.04 LTS supports only an older version. + # As a special case we can install it as a snap package + if grep 16.04 /etc/lsb-release >/dev/null; then + sudo snap install node --classic --channel=8 + return + fi + sudo apt-get install -y nodejs npm +} + set -eu install_android_sdk=n @@ -64,6 +74,9 @@ apt-get -y install build-essential git wget expect kernelshark \ python3 python3-pip python3-venv python3-tk gobject-introspection \ libcairo2-dev libgirepository1.0-dev gir1.2-gtk-3.0 +install_nodejs + if [ "$install_android_sdk" == y ]; then install_sdk fi + diff --git a/setup.py b/setup.py index b8f724f79..f24ca6067 100755 --- a/setup.py +++ b/setup.py @@ -104,7 +104,8 @@ setup( extras_require={ "notebook": [ "ipython", - "jupyterlab" + "jupyterlab", + "ipywidgets", ], "doc": [ diff --git a/shell/lisa_shell b/shell/lisa_shell index 712609de6..06ac0cd3b 100755 --- a/shell/lisa_shell +++ b/shell/lisa_shell @@ -154,6 +154,22 @@ function _lisa-upgrade-pip { fi } +function _lisa-install-nbextensions { + which jupyter &>/dev/null || return + if which node &>/dev/null; then + echo + echo "Enabling ipywidget extensions..." + jupyter labextension install @jupyter-widgets/jupyterlab-manager + return + fi + + # If NodeJS is still not available, we just warn the user + echo + echo "NOTE: Missing NodeJS support!" + echo "Install it on your system and run lisa-install " + echo "again if you want to enable ipywidgets support." +} + function lisa-install { # Check that some prerequisites are available on the system, since they # cannot be installed using pip in a venv @@ -196,6 +212,9 @@ function lisa-install { # Make sure the shell has taken into account the new content of directories # listed in $PATH. _lisa-reload-PATH + + # Install additiona Jupyter Notebook extensions + _lisa-install-nbextensions } ################################################################################ @@ -403,6 +422,9 @@ EOF # LISA Shell MAIN ################################################################################ +# Activate the venv unless it was explicitely disabled +lisa-venv-activate + # Dump out a nice LISA Shell logo clear echo -e "$LISASHELL_BANNER" @@ -418,8 +440,13 @@ Welcome to the Linux Integrated System Analysis SHELL! LISA version : $(git rev-parse --short=11 HEAD) python version : $PYTHON_VERSION LISA_HOME : $LISA_HOME + EOF +if which jupyter >/dev/null; then + jupyter labextension list +fi + cat < Date: Mon, 14 Jan 2019 15:53:22 +0000 Subject: [PATCH 4/4] shell: fix vim modeline Signed-off-by: Patrick Bellasi --- install_base_ubuntu.sh | 1 + shell/lisa_shell | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/install_base_ubuntu.sh b/install_base_ubuntu.sh index 16385662d..71c8ac247 100755 --- a/install_base_ubuntu.sh +++ b/install_base_ubuntu.sh @@ -80,3 +80,4 @@ if [ "$install_android_sdk" == y ]; then install_sdk fi +# vim: set tabstop=4 shiftwidth=4 textwidth=80 expandtab: diff --git a/shell/lisa_shell b/shell/lisa_shell index 06ac0cd3b..57b62c9aa 100755 --- a/shell/lisa_shell +++ b/shell/lisa_shell @@ -457,4 +457,4 @@ EOF # Setup default SHELL text color echo -e "$LISASHELL_DEFAULT" -# vim :set tabstop=4 shiftwidth=4 textwidth=80 expandtab +# vim: set tabstop=4 shiftwidth=4 textwidth=80 expandtab: -- GitLab