From 65d530f2d11cd6c4f74e650c43f0f616620f5ca3 2008-03-22 14:54:44 From: Ville M. Vainio Date: 2008-03-22 14:54:44 Subject: [PATCH] -twisted command line opt launches twisted reactor and uses it to execute code given by ipython mainloop thread --- diff --git a/IPython/Shell.py b/IPython/Shell.py index 2b2f3ee..910ea70 100644 --- a/IPython/Shell.py +++ b/IPython/Shell.py @@ -405,7 +405,7 @@ class MTInteractiveShell(InteractiveShell): # execute directly (to allow recursion and prevent deadlock if code is run early # in IPython construction) - if self.worker_ident is None or self.worker_ident == thread.get_ident(): + if (self.worker_ident is None or self.worker_ident == thread.get_ident()): InteractiveShell.runcode(self,code) return @@ -1155,10 +1155,13 @@ def _select_shell(argv): } all_opts = set(['tk','pylab','gthread','qthread','q4thread','wthread', - 'tkthread']) + 'tkthread', 'twisted']) user_opts = set([s.replace('-','') for s in argv[:3]]) special_opts = user_opts & all_opts + if 'twisted' in special_opts: + import twshell + return twshell.IPShellTwisted if 'tk' in special_opts: USE_TK = True special_opts.remove('tk') diff --git a/IPython/ipmaker.py b/IPython/ipmaker.py index 14c084a..8b37dbd 100644 --- a/IPython/ipmaker.py +++ b/IPython/ipmaker.py @@ -184,10 +184,9 @@ object? -> Details about 'object'. ?object also works, ?? prints more. # Options that can *only* appear at the cmd line (not in rcfiles). - # The "ignore" option is a kludge so that Emacs buffers don't crash, since - # the 'C-c !' command in emacs automatically appends a -i option at the end. cmdline_only = ('help interact|i ipythondir=s Version upgrade ' - 'gthread! qthread! q4thread! wthread! tkthread! pylab! tk!') + 'gthread! qthread! q4thread! wthread! tkthread! pylab! tk! ' + 'twisted!') # Build the actual name list to be used by DPyGetOpt opts_names = qw(cmdline_opts) + qw(cmdline_only) @@ -245,6 +244,7 @@ object? -> Details about 'object'. ?object also works, ?? prints more. system_verbose = 0, term_title = 1, tk = 0, + twisted= 0, upgrade = 0, Version = 0, wildcards_case_sensitive = 1,