Skip to content

Commit

Permalink
recipes-robot/opentrons-jupyter-notebook: add env variables to fix ju…
Browse files Browse the repository at this point in the history
…pyter notebook.
  • Loading branch information
vegano1 committed Nov 16, 2023
1 parent d072193 commit 8d2ce6d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
14 changes: 14 additions & 0 deletions layers/meta-opentrons/classes/get_ot_system_version.bbclass
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# helper bbclass to get the tagged version of oe-core

OT_SYSTEM_VERSION=""

python do_get_oe_version() {
from subprocess import check_output
version=check_output(['git', 'describe', '--tags', '--always']).decode().strip()
if version:
d.setVar("OT_SYSTEM_VERSION", version)
}

addtask do_get_oe_version after do_compile before do_install
do_install[prefuncs] += "do_get_oe_version"

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ SupplementaryGroups=dialout
StateDirectory=jupyter jupyter/notebooks jupyter/data jupyter/config ipython
RuntimeDirectory=jupyter
Environment=RUNNING_ON_VERDIN=true
Environment=OT_SYSTEM_VERSION=
Environment=OT_API_FF_enableOT3HardwareController=true
Environment=PYTHONPATH=/opt/opentrons-robot-server:/usr/lib/python3.8/site-packages
Environment=JUPYTER_RUNTIME_DIR=%t/jupyter
Environment=JUPYTER_CONFIG_DIR=%S/jupyter/config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
inherit systemd
inherit systemd get_ot_system_version

DESCRIPTION = "Jupyter Notebook service for Opentrons."
LICENSE = "Apache-2.0"
Expand All @@ -18,6 +18,9 @@ do_install_append() {
install -d ${D}/${sysconfdir}/systemd/system
install -m 644 ${WORKDIR}/jupyter_notebook_config.py ${D}/${sysconfdir}/jupyter/jupyter_notebook_config.py
install -m 644 ${WORKDIR}/jupyter-notebook.service ${D}/${sysconfdir}/systemd/system/jupyter-notebook.service

# set the system version env variable
sed -i 's/OT_SYSTEM_VERSION=/OT_SYSTEM_VERSION=${OT_SYSTEM_VERSION}/' ${D}/${sysconfdir}/systemd/system/jupyter-notebook.service
}

FILES_${PN} += "${sysconfdir}/jupyter/jupyter_notebook_config.py \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
inherit get_ot_system_version

# Copyright (C) 2023 Seth Foster <seth@opentrons.com>
# Released under the MIT License (see COPYING.MIT for the terms)
DESCRIPTION = "installs defaults for the remote shell user environment"
Expand All @@ -6,15 +8,6 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7ca

SRC_URI = "file://ot-environ.sh"

OT_SYSTEM_VERSION=""

python do_get_oe_version() {
from subprocess import check_output
version=check_output(['git', 'describe', '--tags', '--always']).decode().strip()
if version:
d.setVar("OT_SYSTEM_VERSION", version)
}

do_install() {
install -d ${D}/${sysconfdir}/profile.d/
install -m 0755 ${WORKDIR}/ot-environ.sh ${D}/${sysconfdir}/profile.d/ot-environ.sh
Expand All @@ -23,7 +16,4 @@ do_install() {
echo "export OT_SYSTEM_VERSION=${OT_SYSTEM_VERSION}" >> ${D}/${sysconfdir}/profile.d/ot-environ.sh
}

addtask do_get_oe_version after do_compile before do_install
do_install[prefuncs] += "do_get_oe_version"

FILES_${PN} += "${sysconfdir}/profile.d/ot-environ.sh"

0 comments on commit 8d2ce6d

Please sign in to comment.