##// END OF EJS Templates
update changelog
update changelog

File last commit:

r841:daef07e0
r850:2965dc5c
Show More
ipy_kitcfg.py
56 lines | 1.5 KiB | text/x-python | PythonLexer
vivainio
ipykit.py special launcher, 'py' alias within ipy_kitcfg
r798 import os,sys
vivainio
ipy_kitcfg is used for ipykit setup, 'bin' folder should contain various needed binaries
r704
vivainio
ipython_firstrun(ip) entry point for _ip.load, ipykit enhancement: pylaunchers for launching python scripts
r801 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
vivainio
ipykit.py special launcher, 'py' alias within ipy_kitcfg
r798
vivainio
ipython_firstrun(ip) entry point for _ip.load, ipykit enhancement: pylaunchers for launching python scripts
r801 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.
vivainio
ipykit.py special launcher, 'py' alias within ipy_kitcfg
r798
vivainio
ipykit pylaunchers do .ipy now
r841 .ipy files will be run like macros.
vivainio
ipykit.py special launcher, 'py' alias within ipy_kitcfg
r798 """
vivainio
ipykit pylaunchers do .ipy now
r841 fs = glob.glob('*.?py*')
vivainio
ipython_firstrun(ip) entry point for _ip.load, ipykit enhancement: pylaunchers for launching python scripts
r801 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
vivainio
ipykit.py special launcher, 'py' alias within ipy_kitcfg
r798
vivainio
ipython_firstrun(ip) entry point for _ip.load, ipykit enhancement: pylaunchers for launching python scripts
r801 # note that this is never run, it's just here for py2exe
import distutils.dir_util
vivainio
ipy_kitcfg is used for ipykit setup, 'bin' folder should contain various needed binaries
r704 def main():
root = os.environ.get('IPYKITROOT', None)
if not root:
print "Can't configure ipykit, IPYKITROOT should be set."
return
os.environ["PATH"] = os.environ["PATH"] + ";" + root + "\\bin;"
vivainio
ipython_firstrun(ip) entry point for _ip.load, ipykit enhancement: pylaunchers for launching python scripts
r801 ip.to_user_ns("pylaunchers")
vivainio
ipykit.py special launcher, 'py' alias within ipy_kitcfg
r798
vivainio
ipython_firstrun(ip) entry point for _ip.load, ipykit enhancement: pylaunchers for launching python scripts
r801 def ipython_firstrun(ip):
print "First run of ipykit - configuring"
ip.defalias('py',selflaunch)
ip.defalias('d','ls -F')
ip.defalias('ls','ls')
ip.magic('store py')
ip.magic('store d')
ip.magic('store ls')
vivainio
ipy_kitcfg is used for ipykit setup, 'bin' folder should contain various needed binaries
r704
vivainio
ipython_firstrun(ip) entry point for _ip.load, ipykit enhancement: pylaunchers for launching python scripts
r801 def init_ipython(ipy):
global ip
ip = ipy
main()
vivainio
ipy_kitcfg is used for ipykit setup, 'bin' folder should contain various needed binaries
r704