blob: 4f6877cfaf64408d5d9140b32f6f242864921fe1 (
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# Maintainer: Blair Bonnett <blair dot bonnett at gmail dot com>
# Contributor: Sebastiaan Lokhorst <sebastiaanlokhorst@gmail.com>
# Contributor: Tommy Li <ttoo74@gmail.com>
# Contributor: Mark Lee <mark at markelee dot com>
pkgname=jupyterhub
pkgver=2.3.1
pkgrel=1
pkgdesc="Multi-user server for Jupyter notebooks"
url="https://jupyter.org/hub"
arch=(any)
license=('BSD')
depends=(
'ipython' 'nodejs-configurable-http-proxy' 'python-alembic'
'python-async_generator' 'python-certipy' 'python-entrypoints' 'python-jinja'
'python-jsonschema' 'python-jupyter_telemetry' 'python-oauthlib'
'python-packaging' 'python-pamela' 'python-prometheus_client' 'python-requests'
'python-sqlalchemy' 'python-tornado' 'python-traitlets'
)
makedepends=(
'npm' 'python-build' 'python-installer' 'python-wheel'
)
checkdepends=(
'jupyter-notebook' 'python-beautifulsoup4' 'python-pytest'
'python-pytest-asyncio' 'python-requests-mock'
)
optdepends=(
'jupyter-notebook: standard notebook server'
'jupyterlab: to use the JupyterLab interface'
'python-pycurl: improved HTTP performance'
)
install=jupyterhub.install
backup=(
'etc/jupyterhub/jupyterhub_config.py'
)
source=(
"jupyterhub-${pkgver}.tar.gz::https://github.com/jupyterhub/jupyterhub/archive/${pkgver}.tar.gz"
'jupyterhub.service'
'tests_use_random_ports.patch'
)
sha256sums=(
'dd9605462c1e382b3cc374226ffe9f550cc59643a9de05bbea67630f4a3f6c5a'
'adb4c09c668c35605d9cddc4a4171dd64ed6e74ab82da97f19b3437d26b052b9'
'acba51024276670aabad3d3f2a1c80d4b573809ca7e7ef6594916329d842417f'
)
prepare() {
cd "${srcdir}/jupyterhub-$pkgver"
patch -p0 -i "${srcdir}/tests_use_random_ports.patch"
}
build() {
cd "${srcdir}/jupyterhub-$pkgver"
python -m build --wheel --no-isolation
# Generate the default configuration. The value of data_files_path is set
# based on the directory containing the loaded code, so we need to replace
# it with the final installed destination. We also replace the 'Currently
# installed' headers with 'Included with the jupyterhub package'.
cd build/lib
python -m jupyterhub --generate-config -f "$srcdir/default_config.py" -y True
_srcdir_esc="${srcdir////\\/}"
sed -i "$srcdir/default_config.py" \
-e "s/${_srcdir_esc}\/jupyterhub-$pkgver/\/usr/" \
-e 's/# Currently installed:/# Included with the jupyterhub package:/'
}
check() {
cd "${srcdir}/jupyterhub-$pkgver"
skip_files=(
# DB upgrade tests always seem to fail (virtual environment appears incorrect).
'test_db.py'
# Broken by our patch to use random ports for testing. This enables a lot
# more tests than it breaks so it is a worthwhile trade-off for now.
'test_internal_ssl_connections.py'
)
skip_tests=(
# Needs the package to already be installed.
'test_server_token_role'
# Intermittent failures. For now, trust the upstream CI.
'test_external_service'
'test_single_user_spawner'
'test_nbclassic_control_panel'
)
# The community package jupyter-nbclassic provides and conflicts with
# jupyter-notebook. Some tests depend on nbclassic, some on notebook, so
# selectively skip based on what package is in use.
if pacman -Qqs jupyter-nbclassic > /dev/null; then
skip_tests+=('test_singleuser_app_class[notebook.notebookapp.NotebookApp]')
else
skip_tests+=('test_singleuser_auth' 'test_disable_user_config')
fi
# Start building pytest args with --ignore options for whole files.
testargs=()
for filename in "${skip_files[@]}"; do
testargs+=("--ignore=jupyterhub/tests/$filename")
done
# Add a filter expression with all the tests we want to skip.
karg=""
for testname in "${skip_tests[@]}"; do
karg="$karg and not $testname"
done
testargs+=('-k' "${karg:5}") # Trim the leading ' and '.
PYTHONPATH="$PWD/build/lib" pytest -v jupyterhub "${testargs[@]}"
}
package() {
cd "${srcdir}/jupyterhub-$pkgver"
# Install the package.
python -m installer --destdir="$pkgdir" dist/*.whl
install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname/" COPYING.md
# Remove $srcdir references from npm metadata.
find "$pkgdir" -name package.json -print0 | xargs -r -0 sed -i '/_where/d'
# systemd service and default configuration.
install -Dm644 "$srcdir/jupyterhub.service" "$pkgdir/usr/lib/systemd/system/jupyterhub.service"
install -Dm644 "$srcdir/default_config.py" "$pkgdir/etc/jupyterhub/jupyterhub_config.py"
}
|