##// END OF EJS Templates
Don't blend kernel and frontend CLI args...
Min RK -
Show More
@@ -18,20 +18,13 b' from IPython.config.application import boolean_flag'
18 from IPython.core.profiledir import ProfileDir
18 from IPython.core.profiledir import ProfileDir
19 from IPython.kernel.blocking import BlockingKernelClient
19 from IPython.kernel.blocking import BlockingKernelClient
20 from IPython.kernel import KernelManager
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 from IPython.kernel.kernelspec import NoSuchKernel
22 from IPython.kernel.kernelspec import NoSuchKernel
23 from IPython.utils.path import filefind
23 from IPython.utils.path import filefind
24 from IPython.utils.traitlets import (
24 from IPython.utils.traitlets import (
25 Dict, List, Unicode, CUnicode, CBool, Any
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 from IPython.kernel.zmq.session import Session
27 from IPython.kernel.zmq.session import Session
34 from IPython.kernel.zmq.zmqshell import ZMQInteractiveShell
35 from IPython.kernel.connect import ConnectionFileMixin
28 from IPython.kernel.connect import ConnectionFileMixin
36
29
37 from IPython.utils.localinterfaces import localhost
30 from IPython.utils.localinterfaces import localhost
@@ -40,7 +33,7 b' from IPython.utils.localinterfaces import localhost'
40 # Aliases and Flags
33 # Aliases and Flags
41 #-----------------------------------------------------------------------------
34 #-----------------------------------------------------------------------------
42
35
43 flags = dict(kernel_flags)
36 flags = {}
44
37
45 # the flags that are specific to the frontend
38 # the flags that are specific to the frontend
46 # these must be scrubbed before being passed to the kernel,
39 # these must be scrubbed before being passed to the kernel,
@@ -60,7 +53,7 b' app_flags.update(boolean_flag('
60 ))
53 ))
61 flags.update(app_flags)
54 flags.update(app_flags)
62
55
63 aliases = dict(kernel_aliases)
56 aliases = {}
64
57
65 # also scrub aliases from the frontend
58 # also scrub aliases from the frontend
66 app_aliases = dict(
59 app_aliases = dict(
@@ -140,19 +133,12 b' class IPythonConsoleApp(ConnectionFileMixin):'
140 to force a direct exit without any confirmation.""",
133 to force a direct exit without any confirmation.""",
141 )
134 )
142
135
143 @property
136 def build_kernel_argv(self, argv=None):
144 def help_classes(self):
137 """build argv to be passed to kernel subprocess
145 """ConsoleApps can configure kernels on the command-line
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
141 self.kernel_argv = self.extra_args
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)
156
142
157 def init_connection_file(self):
143 def init_connection_file(self):
158 """find the connection file, and load the info if found.
144 """find the connection file, and load the info if found.
@@ -3,25 +3,10 b''
3 """
3 """
4 The :class:`~IPython.core.application.Application` object for the command
4 The :class:`~IPython.core.application.Application` object for the command
5 line :command:`ipython` program.
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 #-----------------------------------------------------------------------------
8 # Copyright (c) IPython Development Team.
16 # Copyright (C) 2008-2011 The IPython Development Team
9 # Distributed under the terms of the Modified BSD License.
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 #-----------------------------------------------------------------------------
25
10
26 from __future__ import absolute_import
11 from __future__ import absolute_import
27 from __future__ import print_function
12 from __future__ import print_function
@@ -2,17 +2,11 b''
2
2
3 This is not a complete console app, as subprocess will not be able to receive
3 This is not a complete console app, as subprocess will not be able to receive
4 input, there is no real readline support, among other limitations.
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 #-----------------------------------------------------------------------------
7 # Copyright (c) IPython Development Team.
14 # Imports
8 # Distributed under the terms of the Modified BSD License.
15 #-----------------------------------------------------------------------------
9
16 import signal
10 import signal
17
11
18 from IPython.terminal.ipapp import TerminalIPythonApp, frontend_flags as term_flags
12 from IPython.terminal.ipapp import TerminalIPythonApp, frontend_flags as term_flags
@@ -98,10 +92,12 b' class ZMQTerminalIPythonApp(TerminalIPythonApp, IPythonConsoleApp):'
98 frontend_flags = Any(frontend_flags)
92 frontend_flags = Any(frontend_flags)
99
93
100 subcommands = Dict()
94 subcommands = Dict()
95
96 force_interact = True
101
97
102 def parse_command_line(self, argv=None):
98 def parse_command_line(self, argv=None):
103 super(ZMQTerminalIPythonApp, self).parse_command_line(argv)
99 super(ZMQTerminalIPythonApp, self).parse_command_line(argv)
104 self.build_kernel_argv(argv)
100 self.build_kernel_argv(self.extra_args)
105
101
106 def init_shell(self):
102 def init_shell(self):
107 IPythonConsoleApp.initialize(self)
103 IPythonConsoleApp.initialize(self)
@@ -5,13 +5,8 b' input, there is no real readline support, among other limitations.'
5 """
5 """
6
6
7 # Copyright (c) IPython Development Team.
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 import os
10 import os
16 import signal
11 import signal
17 import sys
12 import sys
@@ -46,10 +41,8 b" if os.name == 'nt':"
46
41
47 sys.excepthook = gui_excepthook
42 sys.excepthook = gui_excepthook
48
43
49 # System library imports
50 from IPython.external.qt import QtCore, QtGui
44 from IPython.external.qt import QtCore, QtGui
51
45
52 # Local imports
53 from IPython.config.application import boolean_flag
46 from IPython.config.application import boolean_flag
54 from IPython.config.application import catch_config_error
47 from IPython.config.application import catch_config_error
55 from IPython.core.application import BaseIPythonApplication
48 from IPython.core.application import BaseIPythonApplication
@@ -191,7 +184,7 b' class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp):'
191
184
192 def parse_command_line(self, argv=None):
185 def parse_command_line(self, argv=None):
193 super(IPythonQtConsoleApp, self).parse_command_line(argv)
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 def new_frontend_master(self):
190 def new_frontend_master(self):
General Comments 0
You need to be logged in to leave comments. Login now