##// END OF EJS Templates
Allow an arbitrary number of kernel directories to search
Thomas Kluyver -
Show More
@@ -19,6 +19,12 b" if os.name == 'nt':"
19 SYSTEM_KERNEL_DIR = None
19 SYSTEM_KERNEL_DIR = None
20 else:
20 else:
21 SYSTEM_KERNEL_DIR = "/usr/share/ipython/kernels"
21 SYSTEM_KERNEL_DIR = "/usr/share/ipython/kernels"
22
23 # List of kernel directories to search. Later ones take priority over earlier.
24 kernel_dirs = [
25 SYSTEM_KERNEL_DIR,
26 USER_KERNEL_DIR,
27 ]
22
28
23 NATIVE_KERNEL_NAME = 'python3' if PY3 else 'python2'
29 NATIVE_KERNEL_NAME = 'python3' if PY3 else 'python2'
24
30
@@ -85,8 +91,9 b' def _make_native_kernel_dir():'
85
91
86 def list_kernel_specs():
92 def list_kernel_specs():
87 """Returns a dict mapping kernel names to resource directories."""
93 """Returns a dict mapping kernel names to resource directories."""
88 d = _list_kernels_in(SYSTEM_KERNEL_DIR)
94 d = {}
89 d.update(_list_kernels_in(USER_KERNEL_DIR))
95 for kernel_dir in kernel_dirs:
96 d.update(_list_kernels_in(kernel_dir))
90
97
91 if NATIVE_KERNEL_NAME not in d:
98 if NATIVE_KERNEL_NAME not in d:
92 d[NATIVE_KERNEL_NAME] = _make_native_kernel_dir()
99 d[NATIVE_KERNEL_NAME] = _make_native_kernel_dir()
General Comments 0
You need to be logged in to leave comments. Login now