##// END OF EJS Templates
Merge pull request #6936 from minrk/profile-dir...
Matthias Bussonnier -
r20893:1d5c51bb merge
parent child Browse files
Show More
@@ -18,20 +18,13 b' from IPython.config.application import boolean_flag'
18 18 from IPython.core.profiledir import ProfileDir
19 19 from IPython.kernel.blocking import BlockingKernelClient
20 20 from IPython.kernel import KernelManager
21 from IPython.kernel import tunnel_to_kernel, find_connection_file, swallow_argv
21 from IPython.kernel import tunnel_to_kernel, find_connection_file
22 22 from IPython.kernel.kernelspec import NoSuchKernel
23 23 from IPython.utils.path import filefind
24 24 from IPython.utils.traitlets import (
25 25 Dict, List, Unicode, CUnicode, CBool, Any
26 26 )
27 from IPython.kernel.zmq.kernelapp import (
28 kernel_flags,
29 kernel_aliases,
30 IPKernelApp
31 )
32 from IPython.kernel.zmq.pylab.config import InlineBackend
33 27 from IPython.kernel.zmq.session import Session
34 from IPython.kernel.zmq.zmqshell import ZMQInteractiveShell
35 28 from IPython.kernel.connect import ConnectionFileMixin
36 29
37 30 from IPython.utils.localinterfaces import localhost
@@ -40,7 +33,7 b' from IPython.utils.localinterfaces import localhost'
40 33 # Aliases and Flags
41 34 #-----------------------------------------------------------------------------
42 35
43 flags = dict(kernel_flags)
36 flags = {}
44 37
45 38 # the flags that are specific to the frontend
46 39 # these must be scrubbed before being passed to the kernel,
@@ -60,7 +53,7 b' app_flags.update(boolean_flag('
60 53 ))
61 54 flags.update(app_flags)
62 55
63 aliases = dict(kernel_aliases)
56 aliases = {}
64 57
65 58 # also scrub aliases from the frontend
66 59 app_aliases = dict(
@@ -140,19 +133,12 b' class IPythonConsoleApp(ConnectionFileMixin):'
140 133 to force a direct exit without any confirmation.""",
141 134 )
142 135
143 @property
144 def help_classes(self):
145 """ConsoleApps can configure kernels on the command-line
136 def build_kernel_argv(self, argv=None):
137 """build argv to be passed to kernel subprocess
146 138
147 But this shouldn't be written to a file
139 Override in subclasses if any args should be passed to the kernel
148 140 """
149 return self.classes + [IPKernelApp] + IPKernelApp.classes
150
151 def build_kernel_argv(self, argv=None):
152 """build argv to be passed to kernel subprocess"""
153 if argv is None:
154 argv = sys.argv[1:]
155 self.kernel_argv = swallow_argv(argv, self.frontend_aliases, self.frontend_flags)
141 self.kernel_argv = self.extra_args
156 142
157 143 def init_connection_file(self):
158 144 """find the connection file, and load the info if found.
@@ -354,8 +354,6 b' class NotebookApp(BaseIPythonApplication):'
354 354 list=(NbserverListApp, NbserverListApp.description.splitlines()[0]),
355 355 )
356 356
357 ipython_kernel_argv = List(Unicode)
358
359 357 _log_formatter_cls = LogFormatter
360 358
361 359 def _log_level_default(self):
@@ -777,12 +775,6 b' class NotebookApp(BaseIPythonApplication):'
777 775 c.NotebookApp.file_to_run = f
778 776 self.update_config(c)
779 777
780 def init_kernel_argv(self):
781 """add the profile-dir to arguments to be passed to IPython kernels"""
782 # FIXME: remove special treatment of IPython kernels
783 # Kernel should get *absolute* path to profile directory
784 self.ipython_kernel_argv = ["--profile-dir", self.profile_dir.location]
785
786 778 def init_configurables(self):
787 779 self.kernel_spec_manager = self.kernel_spec_manager_class(
788 780 parent=self,
@@ -791,7 +783,6 b' class NotebookApp(BaseIPythonApplication):'
791 783 self.kernel_manager = self.kernel_manager_class(
792 784 parent=self,
793 785 log=self.log,
794 ipython_kernel_argv=self.ipython_kernel_argv,
795 786 connection_dir=self.profile_dir.security_dir,
796 787 )
797 788 self.contents_manager = self.contents_manager_class(
@@ -999,7 +990,6 b' class NotebookApp(BaseIPythonApplication):'
999 990 def initialize(self, argv=None):
1000 991 super(NotebookApp, self).initialize(argv)
1001 992 self.init_logging()
1002 self.init_kernel_argv()
1003 993 self.init_configurables()
1004 994 self.init_components()
1005 995 self.init_webapp()
@@ -3,25 +3,10 b''
3 3 """
4 4 The :class:`~IPython.core.application.Application` object for the command
5 5 line :command:`ipython` program.
6
7 Authors
8 -------
9
10 * Brian Granger
11 * Fernando Perez
12 * Min Ragan-Kelley
13 6 """
14 7
15 #-----------------------------------------------------------------------------
16 # Copyright (C) 2008-2011 The IPython Development Team
17 #
18 # Distributed under the terms of the BSD License. The full license is in
19 # the file COPYING, distributed as part of this software.
20 #-----------------------------------------------------------------------------
21
22 #-----------------------------------------------------------------------------
23 # Imports
24 #-----------------------------------------------------------------------------
8 # Copyright (c) IPython Development Team.
9 # Distributed under the terms of the Modified BSD License.
25 10
26 11 from __future__ import absolute_import
27 12 from __future__ import print_function
@@ -2,17 +2,11 b''
2 2
3 3 This is not a complete console app, as subprocess will not be able to receive
4 4 input, there is no real readline support, among other limitations.
5
6 Authors:
7
8 * Min RK
9 * Paul Ivanov
10
11 5 """
12 6
13 #-----------------------------------------------------------------------------
14 # Imports
15 #-----------------------------------------------------------------------------
7 # Copyright (c) IPython Development Team.
8 # Distributed under the terms of the Modified BSD License.
9
16 10 import signal
17 11
18 12 from IPython.terminal.ipapp import TerminalIPythonApp, frontend_flags as term_flags
@@ -58,6 +52,7 b' aliases = dict(aliases)'
58 52 frontend_aliases = dict(app_aliases)
59 53 # load updated frontend flags into full dict
60 54 aliases.update(frontend_aliases)
55 aliases['colors'] = 'InteractiveShell.colors'
61 56
62 57 # get flags&aliases into sets, and remove a couple that
63 58 # shouldn't be scrubbed from backend flags:
@@ -98,10 +93,12 b' class ZMQTerminalIPythonApp(TerminalIPythonApp, IPythonConsoleApp):'
98 93 frontend_flags = Any(frontend_flags)
99 94
100 95 subcommands = Dict()
96
97 force_interact = True
101 98
102 99 def parse_command_line(self, argv=None):
103 100 super(ZMQTerminalIPythonApp, self).parse_command_line(argv)
104 self.build_kernel_argv(argv)
101 self.build_kernel_argv(self.extra_args)
105 102
106 103 def init_shell(self):
107 104 IPythonConsoleApp.initialize(self)
@@ -5,13 +5,8 b' input, there is no real readline support, among other limitations.'
5 5 """
6 6
7 7 # Copyright (c) IPython Development Team.
8 # Distributed under the terms of the Modified BSD License.
8 # Distributed under the terms of the Modified BSD License.
9 9
10 #-----------------------------------------------------------------------------
11 # Imports
12 #-----------------------------------------------------------------------------
13
14 # stdlib imports
15 10 import os
16 11 import signal
17 12 import sys
@@ -46,10 +41,8 b" if os.name == 'nt':"
46 41
47 42 sys.excepthook = gui_excepthook
48 43
49 # System library imports
50 44 from IPython.external.qt import QtCore, QtGui
51 45
52 # Local imports
53 46 from IPython.config.application import boolean_flag
54 47 from IPython.config.application import catch_config_error
55 48 from IPython.core.application import BaseIPythonApplication
@@ -191,7 +184,7 b' class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp):'
191 184
192 185 def parse_command_line(self, argv=None):
193 186 super(IPythonQtConsoleApp, self).parse_command_line(argv)
194 self.build_kernel_argv(argv)
187 self.build_kernel_argv(self.extra_args)
195 188
196 189
197 190 def new_frontend_master(self):
General Comments 0
You need to be logged in to leave comments. Login now