|
| 1 | +# Patch jupyter_core to help jupyter find the correct installation path. |
| 2 | +# |
| 3 | +# If jupyter is installed by EasyBuild, jupyter is not in the same place as python. |
| 4 | +# `EB_ENV_JUPYTER_ROOT` is used to indicate where jupyter are and should be set to |
| 5 | +# the instllation path in easyconfigs. |
| 6 | +# Avoid using `ENV_JUPYTER_PATH` and `ENV_CONFIG_PATH`. Otherwise user configuration |
| 7 | +# has lower priority and cannot save their own settings. |
| 8 | +# Author: Chia-Jung Hsu, 2024-01-31 |
| 9 | +# Updated for jupyter-core 5.8.1 by Samuel Moors (Vrije Universiteit Brussel) |
| 10 | + |
| 11 | +diff -ur jupyter_core-5.8.1.orig/jupyter_core/paths.py jupyter_core-5.8.1/jupyter_core/paths.py |
| 12 | +--- jupyter_core-5.8.1.orig/jupyter_core/paths.py 2020-02-02 01:00:00.000000000 +0100 |
| 13 | ++++ jupyter_core-5.8.1/jupyter_core/paths.py 2026-01-23 16:45:30.078244084 +0100 |
| 14 | +@@ -246,7 +246,11 @@ |
| 15 | + "/usr/share/jupyter", |
| 16 | + ] |
| 17 | + |
| 18 | +-ENV_JUPYTER_PATH: list[str] = [str(Path(sys.prefix, "share", "jupyter"))] |
| 19 | ++if os.environ.get("EB_ENV_JUPYTER_ROOT"): |
| 20 | ++ EB_ENV_JUPYTER_ROOT = [p.rstrip(os.sep) for p in os.environ["EB_ENV_JUPYTER_ROOT"].split(os.pathsep)] |
| 21 | ++ ENV_JUPYTER_PATH = [str(Path(p, "share", "jupyter")) for p in EB_ENV_JUPYTER_ROOT] |
| 22 | ++else: |
| 23 | ++ ENV_JUPYTER_PATH: list[str] = [str(Path(sys.prefix, "share", "jupyter"))] |
| 24 | + |
| 25 | + |
| 26 | + def jupyter_path(*subdirs: str) -> list[str]: |
| 27 | +@@ -337,7 +341,11 @@ |
| 28 | + return paths |
| 29 | + |
| 30 | + |
| 31 | +-ENV_CONFIG_PATH: list[str] = [str(Path(sys.prefix, "etc", "jupyter"))] |
| 32 | ++if os.environ.get("EB_ENV_JUPYTER_ROOT"): |
| 33 | ++ EB_ENV_JUPYTER_ROOT = [p.rstrip(os.sep) for p in os.environ["EB_ENV_JUPYTER_ROOT"].split(os.pathsep)] |
| 34 | ++ ENV_CONFIG_PATH = [str(Path(p, "etc", "jupyter")) for p in EB_ENV_JUPYTER_ROOT] |
| 35 | ++else: |
| 36 | ++ ENV_CONFIG_PATH: list[str] = [str(Path(sys.prefix, "etc", "jupyter"))] |
| 37 | + |
| 38 | + if use_platform_dirs(): |
| 39 | + if os.name == "nt" and not _use_programdata: |
0 commit comments