summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e4ac4824df0a035d1228c2592b8cc1c16ae83ac3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Maintainer Yuqing Gu <sffred@qq.com>
pkgname=jupyter-wolframengine_kernel
pkgver=0.9.2
pkgrel=4
pkgdesc="Wolfram Language kernel for Jupyter notebooks"
arch=('any')
url="https://github.com/WolframResearch/WolframLanguageForJupyter"
license=('MIT')
install=jupyter-wolframengine_kernel.install
depends=(python-jupyter_core)
# The wolframengine is listed as optional depends, but you must install
# wolframscript in some way to install this package
optdepends=(wolframengine)

# The installer file is fetched through git but it's not a git packaege
source=("git+https://github.com/WolframResearch/WolframLanguageForJupyter.git")
sha256sums=('SKIP')

prepare() {
  if [ `wolframscript -c 1 2> /dev/null` ]; then
    echo `whoami` > ${srcdir}/username.conf
  else
    echo -e "Login to your linux user that is used to activate WE.\nUsername: \c"
    read name
    if [ -z ${name} ]; then
      echo "Username cannot be empty"
      exit
    fi
    checkw=`su - ${name} -c 'wolframscript -c 1'`
    if [ $checkw -ne 1 ]; then
      echo "No valid wolframscript installation is found"
      exit
    else
      echo "wolframscript activation checked"
    fi
    echo ${name} > ${srcdir}/username.conf
  fi
}

package() {
  echo "Copying installer files"
  mkdir ${pkgdir}/opt 
  cp -r ${srcdir}/WolframLanguageForJupyter ${pkgdir}/opt/WolframLanguageForJupyter

  echo "Generating configure"
  mkdir ${pkgdir}/etc
  cp ${srcdir}/username.conf ${pkgdir}/etc/jupyter-wolframengine_kernel.conf
}