From 69814948f1c6f760d521d6fc5b26e4446e4d7c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Thu, 25 May 2023 22:30:26 -0300 Subject: [PATCH] python3-jupyter_server: update to 2.7.3. --- .../patches/pytest-xdist.patch | 38 ++++++++++++++++++ .../patches/utcnow-deprecation.patch | 39 ++++++++++++++++++ srcpkgs/python3-jupyter_server/template | 40 +++++++++++-------- 3 files changed, 101 insertions(+), 16 deletions(-) create mode 100644 srcpkgs/python3-jupyter_server/patches/pytest-xdist.patch create mode 100644 srcpkgs/python3-jupyter_server/patches/utcnow-deprecation.patch diff --git a/srcpkgs/python3-jupyter_server/patches/pytest-xdist.patch b/srcpkgs/python3-jupyter_server/patches/pytest-xdist.patch new file mode 100644 index 00000000000..4b2c6976a3b --- /dev/null +++ b/srcpkgs/python3-jupyter_server/patches/pytest-xdist.patch @@ -0,0 +1,38 @@ +commit 2dfc67655dd589948250c49c093bd25c4f08f77c +Author: Gonzalo TornarĂ­a +Date: Thu May 25 22:28:37 2023 -0300 + + Fix test param for pytest-xdist + +diff --git a/tests/test_gateway.py b/tests/test_gateway.py +index fec747afe..8f7f8a463 100644 +--- a/tests/test_gateway.py ++++ b/tests/test_gateway.py +@@ -362,15 +362,12 @@ def test_gateway_request_timeout_pad_option( + GatewayClient.clear_instance() + + +-cookie_expire_time = format_datetime(datetime.now(tz=timezone.utc) + timedelta(seconds=180)) +- +- + @pytest.mark.parametrize( + "accept_cookies,expire_arg,expire_param,existing_cookies,cookie_exists", + [ + (False, None, None, "EXISTING=1", False), + (True, None, None, "EXISTING=1", True), +- (True, "Expires", cookie_expire_time, None, True), ++ (True, "Expires", 180, None, True), + (True, "Max-Age", "-360", "EXISTING=1", False), + ], + ) +@@ -389,6 +386,10 @@ def test_gateway_request_with_expiring_cookies( + + cookie: SimpleCookie = SimpleCookie() + cookie.load("SERVERID=1234567; Path=/") ++ if expire_arg == "Expires": ++ expire_param = format_datetime( ++ datetime.now(tz=timezone.utc) + ++ timedelta(seconds=expire_param)) + if expire_arg: + cookie["SERVERID"][expire_arg] = expire_param + diff --git a/srcpkgs/python3-jupyter_server/patches/utcnow-deprecation.patch b/srcpkgs/python3-jupyter_server/patches/utcnow-deprecation.patch new file mode 100644 index 00000000000..e5f7a2af5b3 --- /dev/null +++ b/srcpkgs/python3-jupyter_server/patches/utcnow-deprecation.patch @@ -0,0 +1,39 @@ +See: https://github.com/jupyter-server/jupyter_server/issues/1296#issuecomment-1751887150 + +--- a/jupyter_server/_tz.py ++++ b/jupyter_server/_tz.py +@@ -5,7 +5,7 @@ Just UTC-awareness right now + """ + # Copyright (c) Jupyter Development Team. + # Distributed under the terms of the Modified BSD License. +-from datetime import datetime, timedelta, tzinfo ++from datetime import datetime, timedelta, tzinfo, timezone + + # constant for zero offset + ZERO = timedelta(0) +@@ -39,6 +39,12 @@ def utc_aware(unaware): + utcfromtimestamp = utc_aware(datetime.utcfromtimestamp) + utcnow = utc_aware(datetime.utcnow) + ++def utcnow() -> datetime: ++ """ Return timezone-aware UTC timestamp""" ++ return datetime.now(timezone.utc) ++ ++def utcfromtimestamp(timestamp): ++ return datetime.fromtimestamp(timestamp, timezone.utc) + + def isoformat(dt): + """Return iso-formatted timestamp +diff --git a/tests/test_gateway.py b/tests/test_gateway.py +index 8f7f8a463..598006e29 100644 +--- a/tests/test_gateway.py ++++ b/tests/test_gateway.py +@@ -78,7 +78,7 @@ omitted_kernels: Dict[str, bool] = {} + + def generate_model(name): + """Generate a mocked kernel model. Caller is responsible for adding model to running_kernels dictionary.""" +- dt = datetime.utcnow().isoformat() + "Z" # noqa ++ dt = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z") # noqa + kernel_id = str(uuid.uuid4()) + model = { + "id": kernel_id, diff --git a/srcpkgs/python3-jupyter_server/template b/srcpkgs/python3-jupyter_server/template index 8b1cf9fe7c5..b0bd9f2f758 100644 --- a/srcpkgs/python3-jupyter_server/template +++ b/srcpkgs/python3-jupyter_server/template @@ -1,26 +1,34 @@ # Template file for 'python3-jupyter_server' pkgname=python3-jupyter_server -version=1.23.1 -revision=2 -build_style=python3-module -hostmakedepends="python3-setuptools" -depends="python3-anyio python3-jupyter_client python3-jupyter_nbformat - python3-jupyter_nbconvert python3-terminado - python3-prometheus_client python3-traitlets python3-tornado - python3-Jinja2 python3-send2trash python3-websocket-client" -checkdepends="${depends} python3-argon2 python3-packaging - python3-coverage python3-pytest-mock python3-requests - python3-pytest python3-pytest-timeout python3-pytest-asyncio" +version=2.7.3 +revision=1 +build_style=python3-pep517 +hostmakedepends="hatchling hatch-jupyter-builder" +depends="python3-anyio python3-argon2 python3-jupyter_client + python3-jupyter_events python3-jupyter_nbconvert + python3-jupyter_server_terminals python3-overrides + python3-prometheus_client python3-send2trash + python3-websocket-client" +checkdepends="$depends pandoc python3-ipython_ipykernel + python3-pytest-console-scripts python3-pytest-jupyter + python3-pytest-xdist python3-requests python3-flaky" short_desc="Backend to Jupyter web applications" maintainer="dkwo " license="BSD-3-Clause" -homepage="https://jupyter.org" +homepage="https://github.com/jupyter-server/jupyter_server" changelog="https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/CHANGELOG.md" distfiles="${PYPI_SITE}/j/jupyter-server/jupyter_server-${version}.tar.gz" -checksum=cee48d9d96cecd0f94b7cb41ecd4f0ab05b01643769f61c5d397b7873bc9a1e2 -# missing pytest-tornasync, pytest-console-scripts -make_check=no +checksum=d4916c8581c4ebbc534cebdaa8eca2478d9f3bfdd88eae29fcab0120eac57649 + +if [ "$XBPS_BUILD_ENVIRONMENT" = void-packages-ci ]; then + # these tests fail on CI (connect to a tcp address) + make_check_args=" + --deselect=tests/extension/test_launch.py::test_launch_instance + --deselect=tests/extension/test_launch.py::test_base_url + --deselect=tests/extension/test_launch.py::test_token_file + " +fi post_install() { - vlicense COPYING.md + vlicense LICENSE }