From ca02e133146edf08f41c6c3229594cc3485fae2c Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 19 Mar 2024 17:28:43 -0600 Subject: [PATCH] Add variant typescript for py-jupyter-server@:1, which then requires npm/node. Patch the build system for ~typescript so that it doesn't find any npm/node installations and attempts to build the typescript extension even though it shouldn't --- .../packages/py-jupyter-server/no_npm_node.patch | 14 ++++++++++++++ .../builtin/packages/py-jupyter-server/package.py | 11 +++++++++++ 2 files changed, 25 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-jupyter-server/no_npm_node.patch diff --git a/var/spack/repos/builtin/packages/py-jupyter-server/no_npm_node.patch b/var/spack/repos/builtin/packages/py-jupyter-server/no_npm_node.patch new file mode 100644 index 00000000000000..251acbd44b3921 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-jupyter-server/no_npm_node.patch @@ -0,0 +1,14 @@ +--- a/pyproject.toml 2024-03-19 15:58:20.000000000 -0600 ++++ b/pyproject.toml 2024-03-19 15:59:15.000000000 -0600 +@@ -5,6 +5,11 @@ + [tool.jupyter-packaging.builder] + factory = "jupyter_packaging.npm_builder" + ++# Injected by spack to solve problems with hidden npm/node dependencies ++# https://github.com/spack/spack/issues/41899 ++[tool.jupyter-packaging.build-args] ++npm = "/dev/null" ++ + [tool.check-manifest] + ignore = ["tbump.toml", ".*", "*.yml", "package-lock.json", "bootstrap*", "conftest.py"] + diff --git a/var/spack/repos/builtin/packages/py-jupyter-server/package.py b/var/spack/repos/builtin/packages/py-jupyter-server/package.py index 87afeb95f66095..95ec6ac84257db 100644 --- a/var/spack/repos/builtin/packages/py-jupyter-server/package.py +++ b/var/spack/repos/builtin/packages/py-jupyter-server/package.py @@ -28,6 +28,16 @@ class PyJupyterServer(PythonPackage): version("1.9.0", sha256="7d19006380f6217458a9db309b54e3dab87ced6c06329c61823907bef2a6f51b") version("1.6.1", sha256="242ddd0b644f10e030f917019b47c381e0f2d2b950164af45cbd791d572198ac") + variant( + "typescript", + default=False, + description="Build the typescript code", + when="@:1", + ) + + # https://github.com/spack/spack/issues/41899 + patch("no_npm_node.patch", when="@:1 ~typescript") + depends_on("python@3.8:", when="@2:", type=("build", "run")) depends_on("py-hatchling@1.11:", when="@2:", type="build") # under [tool.hatch.build.hooks.jupyter-builder] in pyproject.toml @@ -37,6 +47,7 @@ class PyJupyterServer(PythonPackage): depends_on("py-jupyter-packaging@0.9:0", when="@1.6.2:", type="build") depends_on("py-pre-commit", when="@1.16:", type="build") depends_on("py-setuptools", type="build") + depends_on("npm", type="build", when="+typescript") depends_on("py-anyio@3.1.0:", when="@2.2.1:", type=("build", "run")) depends_on("py-anyio@3.1.0:3", when="@:2.2.0", type=("build", "run"))