##// END OF EJS Templates
This is a manual merge of certain things in the ipython1-dev branch, revision 46, into the main ...
This is a manual merge of certain things in the ipython1-dev branch, revision 46, into the main ipython branch. This is not a true merge in the formal sense because all history is not coming over with the files. For a detailed history of the added files, please see the ipython1-dev branch or the svn repository on scipy.org that ipython1-dev came from. More specifically, here is what I have done in this commit: 1) Moved the following by hand ipython1.config -> IPython.config ipython1.kernel -> IPython.kernel ipython1.external -> IPython.external ipython1.core -> IPython.kernel.core ipython1.testutils -> IPython.testing ipython1.tools -> IPython.tools 2) Moved IPython.tools.guid -> IPython1.external.guid 3) Renamed: ipython1 -> IPython IPython.core -> IPython.kernel.core IPython.testutils -> IPython.testing 4) Then did a "bzr add" for all the new stuff. That is all folks!

File last commit:

r861:22534c70
r1234:52b55407
Show More
ipy_kitcfg.py
80 lines | 2.0 KiB | text/x-python | PythonLexer
import os,sys
import ipy_rehashdir,glob
from ipy_rehashdir import selflaunch, PyLauncher
def pylaunchers():
"""Create launchers for python scripts in cwd and store them in alias table
This is useful if you want to invoke .py scripts from ipykit session,
just adding .py files in PATH does not work without file association.
.ipy files will be run like macros.
"""
fs = glob.glob('*.py') + glob.glob('*.ipy')
for f in fs:
l = PyLauncher(f)
n = os.path.splitext(f)[0]
ip.defalias(n, l)
ip.magic('store '+n)
def exta_imports():
# add some modules that you'd want to be bundled in the ipykit
# library zip file here. Do this if you get ImportErrors from scripts you
# try to launch with 'py' or pylaunchers. In theory you could include
# the whole stdlib here for full script coverage
# note that this is never run, it's just here for py2exe
import distutils.dir_util
def kitroot():
return os.environ.get('IPYKITROOT', None)
def main():
if not kitroot():
print "Can't configure ipykit, IPYKITROOT should be set."
return
os.environ["PATH"] = os.environ["PATH"] + ";" + kitroot() + "\\bin;"
ip.to_user_ns("pylaunchers")
cmds = ip.db.get('syscmdlist', None)
if cmds is None:
ip.magic('rehashx')
cmds = ip.db.get('syscmdlist', [])
#print cmds
if 'sc1' in cmds:
print "Default editor: Sc1"
import ipy_editors
ipy_editors.scite('sc1')
# for icp, imv, imkdir, etc.
import ipy_fsops
greeting = """\n\n === Welcome to ipykit ===
%quickref - learn quickly about IPython.
"""
def ipython_firstrun(ip):
print "First run of ipykit - configuring"
ip.defalias('py',selflaunch)
ip.defalias('d','dir /w /og /on')
ip.magic('store py')
ip.magic('store d')
bins = kitroot() +'/bin'
print greeting
def init_ipython(ipy):
global ip
ip = ipy
main()