##// END OF EJS Templates
Backport PR #4098: pass profile-dir instead of profile name to Kernel...
Thomas Kluyver -
Show More
@@ -146,6 +146,9 class Application(SingletonConfigurable):
146 # The version string of this application.
146 # The version string of this application.
147 version = Unicode(u'0.0')
147 version = Unicode(u'0.0')
148
148
149 # the argv used to initialize the application
150 argv = List(Unicode)
151
149 # The log level for the application
152 # The log level for the application
150 log_level = Enum((0,10,20,30,40,50,'DEBUG','INFO','WARN','ERROR','CRITICAL'),
153 log_level = Enum((0,10,20,30,40,50,'DEBUG','INFO','WARN','ERROR','CRITICAL'),
151 default_value=logging.WARN,
154 default_value=logging.WARN,
@@ -457,6 +460,7 class Application(SingletonConfigurable):
457 def parse_command_line(self, argv=None):
460 def parse_command_line(self, argv=None):
458 """Parse the command line arguments."""
461 """Parse the command line arguments."""
459 argv = sys.argv[1:] if argv is None else argv
462 argv = sys.argv[1:] if argv is None else argv
463 self.argv = list(argv)
460
464
461 if argv and argv[0] == 'help':
465 if argv and argv[0] == 'help':
462 # turn `ipython help notebook` into `ipython notebook -h`
466 # turn `ipython help notebook` into `ipython notebook -h`
@@ -53,6 +53,7 from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict, Set, Instan
53 # aliases and flags
53 # aliases and flags
54
54
55 base_aliases = {
55 base_aliases = {
56 'profile-dir' : 'ProfileDir.location',
56 'profile' : 'BaseIPythonApplication.profile',
57 'profile' : 'BaseIPythonApplication.profile',
57 'ipython-dir' : 'BaseIPythonApplication.ipython_dir',
58 'ipython-dir' : 'BaseIPythonApplication.ipython_dir',
58 'log-level' : 'Application.log_level',
59 'log-level' : 'Application.log_level',
@@ -253,7 +253,7 aliases.update({
253 aliases.pop('f', None)
253 aliases.pop('f', None)
254
254
255 notebook_aliases = [u'port', u'port-retries', u'ip', u'keyfile', u'certfile',
255 notebook_aliases = [u'port', u'port-retries', u'ip', u'keyfile', u'certfile',
256 u'notebook-dir']
256 u'notebook-dir', u'profile', u'profile-dir']
257
257
258 #-----------------------------------------------------------------------------
258 #-----------------------------------------------------------------------------
259 # NotebookApp
259 # NotebookApp
@@ -474,13 +474,6 class NotebookApp(BaseIPythonApplication):
474
474
475 def parse_command_line(self, argv=None):
475 def parse_command_line(self, argv=None):
476 super(NotebookApp, self).parse_command_line(argv)
476 super(NotebookApp, self).parse_command_line(argv)
477 if argv is None:
478 argv = sys.argv[1:]
479
480 # Scrub frontend-specific flags
481 self.kernel_argv = swallow_argv(argv, notebook_aliases, notebook_flags)
482 # Kernel should inherit default config file from frontend
483 self.kernel_argv.append("--IPKernelApp.parent_appname='%s'" % self.name)
484
477
485 if self.extra_args:
478 if self.extra_args:
486 f = os.path.abspath(self.extra_args[0])
479 f = os.path.abspath(self.extra_args[0])
@@ -491,6 +484,15 class NotebookApp(BaseIPythonApplication):
491 nbdir = os.path.dirname(f)
484 nbdir = os.path.dirname(f)
492 self.config.NotebookManager.notebook_dir = nbdir
485 self.config.NotebookManager.notebook_dir = nbdir
493
486
487 def init_kernel_argv(self):
488 """construct the kernel arguments"""
489 # Scrub frontend-specific flags
490 self.kernel_argv = swallow_argv(self.argv, notebook_aliases, notebook_flags)
491 # Kernel should inherit default config file from frontend
492 self.kernel_argv.append("--IPKernelApp.parent_appname='%s'" % self.name)
493 # Kernel should get *absolute* path to profile directory
494 self.kernel_argv.extend(["--profile-dir", self.profile_dir.location])
495
494 def init_configurables(self):
496 def init_configurables(self):
495 # force Session default to be secure
497 # force Session default to be secure
496 default_secure(self.config)
498 default_secure(self.config)
@@ -657,6 +659,7 class NotebookApp(BaseIPythonApplication):
657 def initialize(self, argv=None):
659 def initialize(self, argv=None):
658 self.init_logging()
660 self.init_logging()
659 super(NotebookApp, self).initialize(argv)
661 super(NotebookApp, self).initialize(argv)
662 self.init_kernel_argv()
660 self.init_configurables()
663 self.init_configurables()
661 self.init_components()
664 self.init_components()
662 self.init_webapp()
665 self.init_webapp()
@@ -71,7 +71,6 class ParallelCrashHandler(CrashHandler):
71 base_aliases = {}
71 base_aliases = {}
72 base_aliases.update(base_ip_aliases)
72 base_aliases.update(base_ip_aliases)
73 base_aliases.update({
73 base_aliases.update({
74 'profile-dir' : 'ProfileDir.location',
75 'work-dir' : 'BaseParallelApplication.work_dir',
74 'work-dir' : 'BaseParallelApplication.work_dir',
76 'log-to-file' : 'BaseParallelApplication.log_to_file',
75 'log-to-file' : 'BaseParallelApplication.log_to_file',
77 'clean-logs' : 'BaseParallelApplication.clean_logs',
76 'clean-logs' : 'BaseParallelApplication.clean_logs',
General Comments 0
You need to be logged in to leave comments. Login now