~ubuntu-branches/debian/sid/calibre/sid

« back to all changes in this revision

Viewing changes to src/calibre/utils/ipython.py

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2014-02-27 07:48:06 UTC
  • mto: This revision was merged to the branch mainline in revision 74.
  • Revision ID: package-import@ubuntu.com-20140227074806-64wdebb3ptosxhhx
Tags: upstream-1.25.0+dfsg
ImportĀ upstreamĀ versionĀ 1.25.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
8
8
__docformat__ = 'restructuredtext en'
9
9
 
10
 
import os
 
10
import os, re, sys
11
11
from calibre.constants import iswindows, cache_dir, get_version
12
12
 
13
13
ipydir = os.path.join(cache_dir(), 'ipython')
164
164
        from IPython.config.loader import Config
165
165
    except ImportError:
166
166
        return simple_repl(user_ns=user_ns)
 
167
    defns = {'os':os, 're':re, 'sys':sys}
167
168
    if not user_ns:
168
 
        user_ns = {}
 
169
        user_ns = defns
 
170
    else:
 
171
        defns.update(user_ns)
 
172
        user_ns = defns
 
173
 
169
174
    c = Config()
170
175
    c.InteractiveShellApp.exec_lines = [
171
176
        'from __future__ import division, absolute_import, unicode_literals, print_function',