From d6e7eb74e48b92358d1731fc06b2415d42775576 Mon Sep 17 00:00:00 2001
From: Isaac Yu <isaacyu1@isaacyu1.com>
Date: Fri, 21 Oct 2022 17:31:31 -0700
Subject: development/jupyter-notebook: Update for 6.5.1

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
---
 development/jupyter-notebook/doinst.sh             |  9 +++
 .../jupyter-notebook/jupyter-notebook.SlackBuild   | 11 ++--
 development/jupyter-notebook/jupyter-notebook.info |  8 +--
 development/jupyter-notebook/nbclassic-0.4.6.patch | 73 ++++++++++++++++++++++
 4 files changed, 93 insertions(+), 8 deletions(-)
 create mode 100644 development/jupyter-notebook/doinst.sh
 create mode 100644 development/jupyter-notebook/nbclassic-0.4.6.patch

(limited to 'development')

diff --git a/development/jupyter-notebook/doinst.sh b/development/jupyter-notebook/doinst.sh
new file mode 100644
index 0000000000000..65c7e2eeb9aa5
--- /dev/null
+++ b/development/jupyter-notebook/doinst.sh
@@ -0,0 +1,9 @@
+if [ -x /usr/bin/update-desktop-database ]; then
+  /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
+fi
+
+if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
+  if [ -x /usr/bin/gtk-update-icon-cache ]; then
+    /usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1
+  fi
+fi
diff --git a/development/jupyter-notebook/jupyter-notebook.SlackBuild b/development/jupyter-notebook/jupyter-notebook.SlackBuild
index 7defee02e5a39..df1b3492bbb26 100644
--- a/development/jupyter-notebook/jupyter-notebook.SlackBuild
+++ b/development/jupyter-notebook/jupyter-notebook.SlackBuild
@@ -26,7 +26,7 @@
 cd $(dirname $0) ; CWD=$(pwd)
 
 PRGNAM=jupyter-notebook
-VERSION=${VERSION:-6.4.12}
+VERSION=${VERSION:-6.5.1}
 BUILD=${BUILD:-1}
 TAG=${TAG:-_SBo}
 PKGTYPE=${PKGTYPE:-tgz}
@@ -82,19 +82,22 @@ find -L . \
  \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
   -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
 
+# Patch for compatibility with nbclassic 0.4.6
+# Credit to Eric Charles: https://github.com/jupyter/notebook/commit/ab716106.patch
+patch -p1 < $CWD/nbclassic-0.4.6.patch
+
 python3 setup.py install --root=$PKG
 
 find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
   | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
 
 mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
-cp -a \
-  CHANGELOG.md CONTRIBUTING.rst LICENSE PKG-INFO README.md \
-  $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a CHANGELOG.md CONTRIBUTING.rst LICENSE README.md $PKG/usr/doc/$PRGNAM-$VERSION
 cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
 
 mkdir -p $PKG/install
 cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
 
 cd $PKG
 /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/development/jupyter-notebook/jupyter-notebook.info b/development/jupyter-notebook/jupyter-notebook.info
index 324bcd70d2239..192737e3e0e3e 100644
--- a/development/jupyter-notebook/jupyter-notebook.info
+++ b/development/jupyter-notebook/jupyter-notebook.info
@@ -1,10 +1,10 @@
 PRGNAM="jupyter-notebook"
-VERSION="6.4.12"
+VERSION="6.5.1"
 HOMEPAGE="https://jupyter.org/"
-DOWNLOAD="https://files.pythonhosted.org/packages/source/n/notebook/notebook-6.4.12.tar.gz"
-MD5SUM="90a5b998e496ed4c18975d3a42960df0"
+DOWNLOAD="https://files.pythonhosted.org/packages/source/n/notebook/notebook-6.5.1.tar.gz"
+MD5SUM="6975a28fb97b5b144d5a2b8f89fea617"
 DOWNLOAD_x86_64=""
 MD5SUM_x86_64=""
-REQUIRES="argon2-cffi jupyter-ipykernel jupyter-nbconvert python-prometheus_client send2trash terminado"
+REQUIRES="jupyter-ipykernel jupyter-nbclassic"
 MAINTAINER="Isaac Yu"
 EMAIL="isaacyu1@isaacyu1.com"
diff --git a/development/jupyter-notebook/nbclassic-0.4.6.patch b/development/jupyter-notebook/nbclassic-0.4.6.patch
new file mode 100644
index 0000000000000..ac3e8fa3a3c0e
--- /dev/null
+++ b/development/jupyter-notebook/nbclassic-0.4.6.patch
@@ -0,0 +1,73 @@
+From ab71610669e7548f2e9050f98da80cf1eba675ae Mon Sep 17 00:00:00 2001
+From: Eric Charles <eric@datalayer.io>
+Date: Sun, 16 Oct 2022 11:36:45 +0200
+Subject: [PATCH] Ensure custom preload is correctly handled
+
+---
+ docs/environment.yml         |  2 +-
+ notebook/templates/page.html | 12 ++++++++++++
+ setup.py                     |  2 +-
+ tools/build-main.js          |  1 +
+ 4 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/docs/environment.yml b/docs/environment.yml
+index 9f2872ecc3..f3b152ddbd 100644
+--- a/docs/environment.yml
++++ b/docs/environment.yml
+@@ -13,7 +13,7 @@ dependencies:
+ - sphinx
+ - terminado
+ - myst-parser
+-- nbclassic==0.4.5
++- nbclassic==0.4.6
+ - pip:
+   - nbsphinx
+   - Send2Trash
+diff --git a/notebook/templates/page.html b/notebook/templates/page.html
+index 927694e937..fb5d642f4e 100644
+--- a/notebook/templates/page.html
++++ b/notebook/templates/page.html
+@@ -98,6 +98,18 @@
+           }
+       })
+ 
++      // error-catching custom-preload.js shim.
++      define("custom-preload", function (require, exports, module) {
++          try {
++              var custom = require('custom/custom-preload');
++              console.debug('loaded custom-preload.js');
++              return custom;
++          } catch (e) {
++              console.error("error loading custom-preload.js", e);
++              return {};
++          }
++      })
++
+     document.nbjs_translations = {{ nbjs_translations|safe }};
+     document.documentElement.lang = navigator.language.toLowerCase();
+     </script>
+diff --git a/setup.py b/setup.py
+index 02cc702ca2..9579214b75 100755
+--- a/setup.py
++++ b/setup.py
+@@ -122,7 +122,7 @@
+         'Send2Trash>=1.8.0',
+         'terminado>=0.8.3',
+         'prometheus_client',
+-        'nbclassic==0.4.5',
++        'nbclassic==0.4.6',
+     ],
+     extras_require = {
+         'test': ['pytest', 'coverage', 'requests', 'testpath',
+diff --git a/tools/build-main.js b/tools/build-main.js
+index 517186476a..0dcccaee64 100644
+--- a/tools/build-main.js
++++ b/tools/build-main.js
+@@ -60,6 +60,7 @@ var rjs_config = {
+ 
+   exclude: [
+     "custom/custom",
++    "custom/custom-preload",
+   ]
+ };
+ 
-- 
cgit v1.2.3