Define variant typescript for py-jupyter-server with explicit dependency on npm (#43279)

* 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

* Fix formatting in var/spack/repos/builtin/packages/py-jupyter-server/package.py

* Constrain typescript variant to py-jupyter-server versions 1.10.2:1

* with when not needed if variant doesn't exist for other versions
This commit is contained in:
Dom Heinzeller 2024-03-20 08:03:18 -06:00 committed by GitHub
parent 7cb0dbf77a
commit 2f0a73f7ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View file

@ -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"]

View file

@ -28,6 +28,11 @@ class PyJupyterServer(PythonPackage):
version("1.9.0", sha256="7d19006380f6217458a9db309b54e3dab87ced6c06329c61823907bef2a6f51b") version("1.9.0", sha256="7d19006380f6217458a9db309b54e3dab87ced6c06329c61823907bef2a6f51b")
version("1.6.1", sha256="242ddd0b644f10e030f917019b47c381e0f2d2b950164af45cbd791d572198ac") version("1.6.1", sha256="242ddd0b644f10e030f917019b47c381e0f2d2b950164af45cbd791d572198ac")
variant("typescript", default=False, description="Build the typescript code", when="@1.10.2:1")
# https://github.com/spack/spack/issues/41899
patch("no_npm_node.patch", when="@1.10.2:1 ~typescript")
depends_on("python@3.8:", when="@2:", type=("build", "run")) depends_on("python@3.8:", when="@2:", type=("build", "run"))
depends_on("py-hatchling@1.11:", when="@2:", type="build") depends_on("py-hatchling@1.11:", when="@2:", type="build")
# under [tool.hatch.build.hooks.jupyter-builder] in pyproject.toml # under [tool.hatch.build.hooks.jupyter-builder] in pyproject.toml
@ -38,6 +43,7 @@ class PyJupyterServer(PythonPackage):
depends_on("py-pre-commit", when="@1.16:", type="build") depends_on("py-pre-commit", when="@1.16:", type="build")
depends_on("py-setuptools", 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:", when="@2.2.1:", type=("build", "run"))
depends_on("py-anyio@3.1.0:3", when="@:2.2.0", type=("build", "run")) depends_on("py-anyio@3.1.0:3", when="@:2.2.0", type=("build", "run"))
depends_on("py-argon2-cffi", type=("build", "run")) depends_on("py-argon2-cffi", type=("build", "run"))