From 315ef1113b0c5168ccb3f176dd8bc65f58af2e03 Mon Sep 17 00:00:00 2001 From: Brayan Almonte Date: Mon, 18 Sep 2023 09:34:24 -0400 Subject: [PATCH] opentrons-ot3-image: Add python3 pip module so users can install python packages. (#104) --- .../python3-pip/files/pip.conf | 2 ++ .../python3-pip/files/user-packages.pth | 2 ++ .../python3-pip/python3-pip_%.bbappend | 21 +++++++++++++++++++ .../images/opentrons-ot3-image.bb | 3 ++- .../files/ot-environ.sh | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 layers/meta-opentrons/recipes-devtools/python3-pip/files/pip.conf create mode 100644 layers/meta-opentrons/recipes-devtools/python3-pip/files/user-packages.pth create mode 100644 layers/meta-opentrons/recipes-devtools/python3-pip/python3-pip_%.bbappend diff --git a/layers/meta-opentrons/recipes-devtools/python3-pip/files/pip.conf b/layers/meta-opentrons/recipes-devtools/python3-pip/files/pip.conf new file mode 100644 index 00000000..20f66279 --- /dev/null +++ b/layers/meta-opentrons/recipes-devtools/python3-pip/files/pip.conf @@ -0,0 +1,2 @@ +[install] +root = /var/user-packages diff --git a/layers/meta-opentrons/recipes-devtools/python3-pip/files/user-packages.pth b/layers/meta-opentrons/recipes-devtools/python3-pip/files/user-packages.pth new file mode 100644 index 00000000..df9d15de --- /dev/null +++ b/layers/meta-opentrons/recipes-devtools/python3-pip/files/user-packages.pth @@ -0,0 +1,2 @@ +# Add the path to the rw package directory in /var +/var/user-packages/usr/lib/python3.8/site-packages/ diff --git a/layers/meta-opentrons/recipes-devtools/python3-pip/python3-pip_%.bbappend b/layers/meta-opentrons/recipes-devtools/python3-pip/python3-pip_%.bbappend new file mode 100644 index 00000000..319ab3e1 --- /dev/null +++ b/layers/meta-opentrons/recipes-devtools/python3-pip/python3-pip_%.bbappend @@ -0,0 +1,21 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI_append += "\ + file://pip.conf \ + file://user-packages.pth \ + " + +do_install_append() { + # install pip config file to set the package install dir to a read/write part of the rootfs + install -d ${D}/${sysconfdir} + install -m 644 ${WORKDIR}/pip.conf ${D}/${sysconfdir}/pip.conf + + # install pth file so python knows where to find user installed packages + install -d ${D}/${libdir} + install -m 644 ${WORKDIR}/user-packages.pth ${D}/${libdir}/python3.8/site-packages/ +} + +FILES_${PN} += "\ + ${sysconfdir}/pip.conf \ + ${libdir}/user-packages.pth \ + " diff --git a/layers/meta-opentrons/recipes-images/images/opentrons-ot3-image.bb b/layers/meta-opentrons/recipes-images/images/opentrons-ot3-image.bb index 066abf20..38f660e0 100644 --- a/layers/meta-opentrons/recipes-images/images/opentrons-ot3-image.bb +++ b/layers/meta-opentrons/recipes-images/images/opentrons-ot3-image.bb @@ -48,11 +48,12 @@ IMAGE_INSTALL += " \ weston-xwayland weston weston-init imx-gpu-viv \ robot-app-wayland-launch opentrons-robot-app \ opentrons-robot-server opentrons-update-server \ - python3 python3-misc python3-modules python3-jupyter \ opentrons-jupyter-notebook opentrons-usb-bridge \ opentrons-system-server opentrons-mcu-firmware \ opentrons-user-environment opentrons-module-firmware \ opentrons-systemd-units opentrons-ssh-keys \ + python3 python3-misc python3-modules python3-jupyter \ + python3-pip \ " # We do NOT want the toradex libusbgx packages that autoconfigure the OTG USB diff --git a/layers/meta-opentrons/recipes-robot/opentrons-user-environment/files/ot-environ.sh b/layers/meta-opentrons/recipes-robot/opentrons-user-environment/files/ot-environ.sh index 0822f75a..0bea1255 100644 --- a/layers/meta-opentrons/recipes-robot/opentrons-user-environment/files/ot-environ.sh +++ b/layers/meta-opentrons/recipes-robot/opentrons-user-environment/files/ot-environ.sh @@ -2,3 +2,4 @@ export RUNNING_ON_VERDIN=1 export OT_API_FF_enableOT3HardwareController="true" export PYTHONPATH=$PYTHONPATH:/opt/opentrons-robot-server +export PATH=$PATH:/var/user-packages/usr/bin