From e840a5875b865ca1c8673e8f227ca0df86d0f16a Mon Sep 17 00:00:00 2001 From: George Hunt Date: Wed, 1 Sep 2021 03:30:39 +0100 Subject: [PATCH] use python to report the location of site_packages --- roles/jupyterhub/templates/patch_await.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/jupyterhub/templates/patch_await.sh b/roles/jupyterhub/templates/patch_await.sh index 6a3794dfb..a4a33b865 100755 --- a/roles/jupyterhub/templates/patch_await.sh +++ b/roles/jupyterhub/templates/patch_await.sh @@ -1,10 +1,12 @@ #!/bin/bash -x # add await to asyncio change password function -cat {{ jupyterhub_venv }}/lib/*/site-packages/firstuseauthenticator/firstuseauthenticator.py |grep 'await self.render' +SITE_PACKAGES=$({{ jupyterhub_venv }}/bin/python -m site|grep -v exist|grep site) +SITE_PACKAGES=${SITE_PACKAGES:5:-2} +cat $SITE_PACKAGES/firstuseauthenticator/firstuseauthenticator.py |grep 'await self.render' if [ $? -ne 0 ];then echo Updating file - sed -i -e's/self.render/await self.render/' {{ jupyterhub_venv }}/lib/*/site-packages/firstuseauthenticator/firstuseauthenticator.py + sed -i -e's/self.render/await self.render/' $SITE_PACKAGES/firstuseauthenticator/firstuseauthenticator.py else echo Patch already applied. Skipping. . . fi