py-jupyter-core: set environment variables for extensions (#47192)

* py-jupyter-core: set environment variables for extensions

* Changes committed by gh-spack-pr

---------

Co-authored-by: Bernhard Kaindl <bernhardkaindl7@gmail.com>
This commit is contained in:
Adam J. Stewart 2024-10-29 14:45:26 +01:00 committed by GitHub
parent c302049b5d
commit ca48233ef7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,8 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack.package import *
@ -45,3 +47,10 @@ class PyJupyterCore(PythonPackage):
# Historical dependencies
depends_on("py-setuptools", when="@:4.9.2", type=("build", "run"))
def setup_dependent_run_environment(self, env, dependent_spec):
# https://docs.jupyter.org/en/stable/use/jupyter-directories.html
if os.path.exists(dependent_spec.prefix.etc.jupyter):
env.prepend_path("JUPYTER_CONFIG_PATH", dependent_spec.prefix.etc.jupyter)
if os.path.exists(dependent_spec.prefix.share.jupyter):
env.prepend_path("JUPYTER_PATH", dependent_spec.prefix.share.jupyter)