##// END OF EJS Templates
Update kernelspec command line interface
Thomas Kluyver -
Show More
@@ -45,10 +45,10 b' class InstallKernelSpec(BaseIPythonApplication):'
45 def _kernel_name_default(self):
45 def _kernel_name_default(self):
46 return os.path.basename(self.sourcedir)
46 return os.path.basename(self.sourcedir)
47
47
48 system = Bool(False, config=True,
48 user = Bool(False, config=True,
49 help="""
49 help="""
50 Try to install the kernel spec to the systemwide directory instead of
50 Try to install the kernel spec to the per-user directory instead of
51 the per-user directory.
51 the system or environment directory.
52 """
52 """
53 )
53 )
54 replace = Bool(False, config=True,
54 replace = Bool(False, config=True,
@@ -59,8 +59,8 b' class InstallKernelSpec(BaseIPythonApplication):'
59 for k in ['ipython-dir', 'log-level']:
59 for k in ['ipython-dir', 'log-level']:
60 aliases[k] = base_aliases[k]
60 aliases[k] = base_aliases[k]
61
61
62 flags = {'system': ({'InstallKernelSpec': {'system': True}},
62 flags = {'user': ({'InstallKernelSpec': {'user': True}},
63 "Install to the systemwide kernel registry"),
63 "Install to the per-user kernel registry"),
64 'replace': ({'InstallKernelSpec': {'replace': True}},
64 'replace': ({'InstallKernelSpec': {'replace': True}},
65 "Replace any existing kernel spec with this name."),
65 "Replace any existing kernel spec with this name."),
66 'debug': base_flags['debug'],
66 'debug': base_flags['debug'],
@@ -79,7 +79,7 b' class InstallKernelSpec(BaseIPythonApplication):'
79 try:
79 try:
80 self.kernel_spec_manager.install_kernel_spec(self.sourcedir,
80 self.kernel_spec_manager.install_kernel_spec(self.sourcedir,
81 kernel_name=self.kernel_name,
81 kernel_name=self.kernel_name,
82 system=self.system,
82 user=self.user,
83 replace=self.replace,
83 replace=self.replace,
84 )
84 )
85 except OSError as e:
85 except OSError as e:
@@ -98,23 +98,23 b' class InstallNativeKernelSpec(BaseIPythonApplication):'
98 def _kernel_spec_manager_default(self):
98 def _kernel_spec_manager_default(self):
99 return KernelSpecManager(ipython_dir=self.ipython_dir)
99 return KernelSpecManager(ipython_dir=self.ipython_dir)
100
100
101 system = Bool(False, config=True,
101 user = Bool(False, config=True,
102 help="""
102 help="""
103 Try to install the kernel spec to the systemwide directory instead of
103 Try to install the kernel spec to the per-user directory instead of
104 the per-user directory.
104 the system or environment directory.
105 """
105 """
106 )
106 )
107
107
108 # Not all of the base aliases are meaningful (e.g. profile)
108 # Not all of the base aliases are meaningful (e.g. profile)
109 aliases = {k: base_aliases[k] for k in ['ipython-dir', 'log-level']}
109 aliases = {k: base_aliases[k] for k in ['ipython-dir', 'log-level']}
110 flags = {'system': ({'InstallNativeKernelSpec': {'system': True}},
110 flags = {'user': ({'InstallNativeKernelSpec': {'user': True}},
111 "Install to the systemwide kernel registry"),
111 "Install to the per-user kernel registry"),
112 'debug': base_flags['debug'],
112 'debug': base_flags['debug'],
113 }
113 }
114
114
115 def start(self):
115 def start(self):
116 try:
116 try:
117 self.kernel_spec_manager.install_native_kernel_spec(system=self.system)
117 self.kernel_spec_manager.install_native_kernel_spec(user=self.user)
118 except OSError as e:
118 except OSError as e:
119 self.exit(e)
119 self.exit(e)
120
120
General Comments 0
You need to be logged in to leave comments. Login now