##// END OF EJS Templates
Merge with upstream.
Gael Varoquaux -
r1647:9173238a merge
parent child Browse files
Show More
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
@@ -0,0 +1,32 b''
1 # encoding: utf-8
2
3 """Tests for genutils.py"""
4
5 __docformat__ = "restructuredtext en"
6
7 #-----------------------------------------------------------------------------
8 # Copyright (C) 2008 The IPython Development Team
9 #
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
12 #-----------------------------------------------------------------------------
13
14 #-----------------------------------------------------------------------------
15 # Imports
16 #-----------------------------------------------------------------------------
17
18 from IPython import genutils
19
20
21 def test_get_home_dir():
22 """Make sure we can get the home directory."""
23 home_dir = genutils.get_home_dir()
24
25 def test_get_ipython_dir():
26 """Make sure we can get the ipython directory."""
27 ipdir = genutils.get_ipython_dir()
28
29 def test_get_security_dir():
30 """Make sure we can get the ipython/security directory."""
31 sdir = genutils.get_security_dir()
32 No newline at end of file
@@ -16,7 +16,9 b' __docformat__ = "restructuredtext en"'
16 #-------------------------------------------------------------------------------
16 #-------------------------------------------------------------------------------
17
17
18 import os
18 import os
19 from IPython.config.cutils import get_home_dir, get_ipython_dir
19 from os.path import join as pjoin
20
21 from IPython.genutils import get_home_dir, get_ipython_dir
20 from IPython.external.configobj import ConfigObj
22 from IPython.external.configobj import ConfigObj
21
23
22 # Traitlets config imports
24 # Traitlets config imports
@@ -53,7 +55,7 b' class ConfigObjManager(object):'
53
55
54 def write_default_config_file(self):
56 def write_default_config_file(self):
55 ipdir = get_ipython_dir()
57 ipdir = get_ipython_dir()
56 fname = ipdir + '/' + self.filename
58 fname = pjoin(ipdir, self.filename)
57 if not os.path.isfile(fname):
59 if not os.path.isfile(fname):
58 print "Writing the configuration file to: " + fname
60 print "Writing the configuration file to: " + fname
59 self.write_config_obj_to_file(fname)
61 self.write_config_obj_to_file(fname)
@@ -87,11 +89,11 b' class ConfigObjManager(object):'
87
89
88 # In ipythondir if it is set
90 # In ipythondir if it is set
89 if ipythondir is not None:
91 if ipythondir is not None:
90 trythis = ipythondir + '/' + filename
92 trythis = pjoin(ipythondir, filename)
91 if os.path.isfile(trythis):
93 if os.path.isfile(trythis):
92 return trythis
94 return trythis
93
95
94 trythis = get_ipython_dir() + '/' + filename
96 trythis = pjoin(get_ipython_dir(), filename)
95 if os.path.isfile(trythis):
97 if os.path.isfile(trythis):
96 return trythis
98 return trythis
97
99
@@ -22,71 +22,6 b' import sys'
22 # Normal code begins
22 # Normal code begins
23 #---------------------------------------------------------------------------
23 #---------------------------------------------------------------------------
24
24
25 class HomeDirError(Exception):
26 pass
27
28 def get_home_dir():
29 """Return the closest possible equivalent to a 'home' directory.
30
31 We first try $HOME. Absent that, on NT it's $HOMEDRIVE\$HOMEPATH.
32
33 Currently only Posix and NT are implemented, a HomeDirError exception is
34 raised for all other OSes. """
35
36 isdir = os.path.isdir
37 env = os.environ
38 try:
39 homedir = env['HOME']
40 if not isdir(homedir):
41 # in case a user stuck some string which does NOT resolve to a
42 # valid path, it's as good as if we hadn't foud it
43 raise KeyError
44 return homedir
45 except KeyError:
46 if os.name == 'posix':
47 raise HomeDirError,'undefined $HOME, IPython can not proceed.'
48 elif os.name == 'nt':
49 # For some strange reason, win9x returns 'nt' for os.name.
50 try:
51 homedir = os.path.join(env['HOMEDRIVE'],env['HOMEPATH'])
52 if not isdir(homedir):
53 homedir = os.path.join(env['USERPROFILE'])
54 if not isdir(homedir):
55 raise HomeDirError
56 return homedir
57 except:
58 try:
59 # Use the registry to get the 'My Documents' folder.
60 import _winreg as wreg
61 key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
62 "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
63 homedir = wreg.QueryValueEx(key,'Personal')[0]
64 key.Close()
65 if not isdir(homedir):
66 e = ('Invalid "Personal" folder registry key '
67 'typically "My Documents".\n'
68 'Value: %s\n'
69 'This is not a valid directory on your system.' %
70 homedir)
71 raise HomeDirError(e)
72 return homedir
73 except HomeDirError:
74 raise
75 except:
76 return 'C:\\'
77 elif os.name == 'dos':
78 # Desperate, may do absurd things in classic MacOS. May work under DOS.
79 return 'C:\\'
80 else:
81 raise HomeDirError,'support for your operating system not implemented.'
82
83 def get_ipython_dir():
84 ipdir_def = '.ipython'
85 home_dir = get_home_dir()
86 ipdir = os.path.abspath(os.environ.get('IPYTHONDIR',
87 os.path.join(home_dir,ipdir_def)))
88 return ipdir
89
90 def import_item(key):
25 def import_item(key):
91 """
26 """
92 Import and return bar given the string foo.bar.
27 Import and return bar given the string foo.bar.
@@ -25,6 +25,8 b' except ImportError:'
25 import nose
25 import nose
26 raise nose.SkipTest("This test requires zope.interface, Twisted and Foolscap")
26 raise nose.SkipTest("This test requires zope.interface, Twisted and Foolscap")
27
27
28 from IPython.testing.decorators import skip
29
28 class FrontEndCallbackChecker(AsyncFrontEndBase):
30 class FrontEndCallbackChecker(AsyncFrontEndBase):
29 """FrontEndBase subclass for checking callbacks"""
31 """FrontEndBase subclass for checking callbacks"""
30 def __init__(self, engine=None, history=None):
32 def __init__(self, engine=None, history=None):
@@ -56,12 +58,10 b' class TestAsyncFrontendBase(unittest.TestCase):'
56
58
57 self.fb = FrontEndCallbackChecker(engine=EngineService())
59 self.fb = FrontEndCallbackChecker(engine=EngineService())
58
60
59
60 def test_implements_IFrontEnd(self):
61 def test_implements_IFrontEnd(self):
61 assert(frontendbase.IFrontEnd.implementedBy(
62 assert(frontendbase.IFrontEnd.implementedBy(
62 AsyncFrontEndBase))
63 AsyncFrontEndBase))
63
64
64
65 def test_is_complete_returns_False_for_incomplete_block(self):
65 def test_is_complete_returns_False_for_incomplete_block(self):
66 """"""
66 """"""
67
67
@@ -80,7 +80,6 b' class TestAsyncFrontendBase(unittest.TestCase):'
80
80
81 assert(self.fb.is_complete(block))
81 assert(self.fb.is_complete(block))
82
82
83
84 def test_blockID_added_to_result(self):
83 def test_blockID_added_to_result(self):
85 block = """3+3"""
84 block = """3+3"""
86
85
@@ -113,12 +112,11 b' class TestAsyncFrontendBase(unittest.TestCase):'
113 d = self.fb.execute("10+10")
112 d = self.fb.execute("10+10")
114 d.addCallback(self.checkCallbacks)
113 d.addCallback(self.checkCallbacks)
115
114
116
117 def checkCallbacks(self, result):
115 def checkCallbacks(self, result):
118 assert(self.fb.updateCalled)
116 assert(self.fb.updateCalled)
119 assert(self.fb.renderResultCalled)
117 assert(self.fb.renderResultCalled)
120
118
121
119 @skip("This test fails and lead to an unhandled error in a Deferred.")
122 def test_error_callback_added_to_execute(self):
120 def test_error_callback_added_to_execute(self):
123 """test that render_error called on execution error"""
121 """test that render_error called on execution error"""
124
122
@@ -19,6 +19,9 b' import sys'
19 from IPython.frontend._process import PipedProcess
19 from IPython.frontend._process import PipedProcess
20 from IPython.testing import decorators as testdec
20 from IPython.testing import decorators as testdec
21
21
22
23 # FIXME
24 @testdec.skip("This doesn't work under Windows")
22 def test_capture_out():
25 def test_capture_out():
23 """ A simple test to see if we can execute a process and get the output.
26 """ A simple test to see if we can execute a process and get the output.
24 """
27 """
@@ -29,6 +32,7 b' def test_capture_out():'
29 result = s.getvalue().rstrip()
32 result = s.getvalue().rstrip()
30 assert result == '1'
33 assert result == '1'
31
34
35
32 # FIXME
36 # FIXME
33 @testdec.skip("This doesn't work under Windows")
37 @testdec.skip("This doesn't work under Windows")
34 def test_io():
38 def test_io():
@@ -47,6 +51,8 b' def test_io():'
47 assert result == test_string
51 assert result == test_string
48
52
49
53
54 # FIXME
55 @testdec.skip("This doesn't work under Windows")
50 def test_kill():
56 def test_kill():
51 """ Check that we can kill a process, and its subprocess.
57 """ Check that we can kill a process, and its subprocess.
52 """
58 """
@@ -979,6 +979,38 b' def get_home_dir():'
979 else:
979 else:
980 raise HomeDirError,'support for your operating system not implemented.'
980 raise HomeDirError,'support for your operating system not implemented.'
981
981
982
983 def get_ipython_dir():
984 """Get the IPython directory for this platform and user.
985
986 This uses the logic in `get_home_dir` to find the home directory
987 and the adds either .ipython or _ipython to the end of the path.
988 """
989 if os.name == 'posix':
990 ipdir_def = '.ipython'
991 else:
992 ipdir_def = '_ipython'
993 home_dir = get_home_dir()
994 ipdir = os.path.abspath(os.environ.get('IPYTHONDIR',
995 os.path.join(home_dir,ipdir_def)))
996 return ipdir
997
998 def get_security_dir():
999 """Get the IPython security directory.
1000
1001 This directory is the default location for all security related files,
1002 including SSL/TLS certificates and FURL files.
1003
1004 If the directory does not exist, it is created with 0700 permissions.
1005 If it exists, permissions are set to 0700.
1006 """
1007 security_dir = os.path.join(get_ipython_dir(), 'security')
1008 if not os.path.isdir(security_dir):
1009 os.mkdir(security_dir, 0700)
1010 else:
1011 os.chmod(security_dir, 0700)
1012 return security_dir
1013
982 #****************************************************************************
1014 #****************************************************************************
983 # strings and text
1015 # strings and text
984
1016
@@ -15,17 +15,15 b' __docformat__ = "restructuredtext en"'
15 # Imports
15 # Imports
16 #-------------------------------------------------------------------------------
16 #-------------------------------------------------------------------------------
17
17
18 from os.path import join as pjoin
19
18 from IPython.external.configobj import ConfigObj
20 from IPython.external.configobj import ConfigObj
19 from IPython.config.api import ConfigObjManager
21 from IPython.config.api import ConfigObjManager
20 from IPython.config.cutils import get_ipython_dir
22 from IPython.genutils import get_ipython_dir, get_security_dir
21
23
22 default_kernel_config = ConfigObj()
24 default_kernel_config = ConfigObj()
23
25
24 try:
26 security_dir = get_security_dir()
25 ipython_dir = get_ipython_dir() + '/'
26 except:
27 # This will defaults to the cwd
28 ipython_dir = ''
29
27
30 #-------------------------------------------------------------------------------
28 #-------------------------------------------------------------------------------
31 # Engine Configuration
29 # Engine Configuration
@@ -33,7 +31,7 b' except:'
33
31
34 engine_config = dict(
32 engine_config = dict(
35 logfile = '', # Empty means log to stdout
33 logfile = '', # Empty means log to stdout
36 furl_file = ipython_dir + 'ipcontroller-engine.furl'
34 furl_file = pjoin(security_dir, 'ipcontroller-engine.furl')
37 )
35 )
38
36
39 #-------------------------------------------------------------------------------
37 #-------------------------------------------------------------------------------
@@ -69,10 +67,10 b' controller_config = dict('
69 port = 0, # 0 means pick a port for me
67 port = 0, # 0 means pick a port for me
70 location = '', # Empty string means try to set automatically
68 location = '', # Empty string means try to set automatically
71 secure = True,
69 secure = True,
72 cert_file = ipython_dir + 'ipcontroller-engine.pem',
70 cert_file = pjoin(security_dir, 'ipcontroller-engine.pem'),
73 ),
71 ),
74 engine_fc_interface = 'IPython.kernel.enginefc.IFCControllerBase',
72 engine_fc_interface = 'IPython.kernel.enginefc.IFCControllerBase',
75 engine_furl_file = ipython_dir + 'ipcontroller-engine.furl',
73 engine_furl_file = pjoin(security_dir, 'ipcontroller-engine.furl'),
76
74
77 controller_interfaces = dict(
75 controller_interfaces = dict(
78 # multiengine = dict(
76 # multiengine = dict(
@@ -83,12 +81,12 b' controller_config = dict('
83 task = dict(
81 task = dict(
84 controller_interface = 'IPython.kernel.task.ITaskController',
82 controller_interface = 'IPython.kernel.task.ITaskController',
85 fc_interface = 'IPython.kernel.taskfc.IFCTaskController',
83 fc_interface = 'IPython.kernel.taskfc.IFCTaskController',
86 furl_file = ipython_dir + 'ipcontroller-tc.furl'
84 furl_file = pjoin(security_dir, 'ipcontroller-tc.furl')
87 ),
85 ),
88 multiengine = dict(
86 multiengine = dict(
89 controller_interface = 'IPython.kernel.multiengine.IMultiEngine',
87 controller_interface = 'IPython.kernel.multiengine.IMultiEngine',
90 fc_interface = 'IPython.kernel.multienginefc.IFCSynchronousMultiEngine',
88 fc_interface = 'IPython.kernel.multienginefc.IFCSynchronousMultiEngine',
91 furl_file = ipython_dir + 'ipcontroller-mec.furl'
89 furl_file = pjoin(security_dir, 'ipcontroller-mec.furl')
92 )
90 )
93 ),
91 ),
94
92
@@ -97,7 +95,7 b' controller_config = dict('
97 port = 0, # 0 means pick a port for me
95 port = 0, # 0 means pick a port for me
98 location = '', # Empty string means try to set automatically
96 location = '', # Empty string means try to set automatically
99 secure = True,
97 secure = True,
100 cert_file = ipython_dir + 'ipcontroller-client.pem'
98 cert_file = pjoin(security_dir, 'ipcontroller-client.pem')
101 )
99 )
102 )
100 )
103
101
@@ -108,10 +106,10 b' controller_config = dict('
108 client_config = dict(
106 client_config = dict(
109 client_interfaces = dict(
107 client_interfaces = dict(
110 task = dict(
108 task = dict(
111 furl_file = ipython_dir + 'ipcontroller-tc.furl'
109 furl_file = pjoin(security_dir, 'ipcontroller-tc.furl')
112 ),
110 ),
113 multiengine = dict(
111 multiengine = dict(
114 furl_file = ipython_dir + 'ipcontroller-mec.furl'
112 furl_file = pjoin(security_dir, 'ipcontroller-mec.furl')
115 )
113 )
116 )
114 )
117 )
115 )
@@ -50,7 +50,7 b' from IPython.kernel.engineservice import \\'
50 IEngineSerialized, \
50 IEngineSerialized, \
51 IEngineQueued
51 IEngineQueued
52
52
53 from IPython.config import cutils
53 from IPython.genutils import get_ipython_dir
54 from IPython.kernel import codeutil
54 from IPython.kernel import codeutil
55
55
56 #-------------------------------------------------------------------------------
56 #-------------------------------------------------------------------------------
@@ -170,7 +170,7 b' class ControllerService(object, service.Service):'
170
170
171 def _getEngineInfoLogFile(self):
171 def _getEngineInfoLogFile(self):
172 # Store all logs inside the ipython directory
172 # Store all logs inside the ipython directory
173 ipdir = cutils.get_ipython_dir()
173 ipdir = get_ipython_dir()
174 pjoin = os.path.join
174 pjoin = os.path.join
175 logdir_base = pjoin(ipdir,'log')
175 logdir_base = pjoin(ipdir,'log')
176 if not os.path.isdir(logdir_base):
176 if not os.path.isdir(logdir_base):
@@ -93,7 +93,7 b' from subprocess import Popen,call'
93 # IPython imports
93 # IPython imports
94 #---------------------------------------------------------------------------
94 #---------------------------------------------------------------------------
95 from IPython.tools import utils
95 from IPython.tools import utils
96 from IPython.config import cutils
96 from IPython.genutils import get_ipython_dir
97
97
98 #---------------------------------------------------------------------------
98 #---------------------------------------------------------------------------
99 # Normal code begins
99 # Normal code begins
@@ -180,7 +180,7 b' def clusterLocal(opt,arg):'
180 """Start a cluster on the local machine."""
180 """Start a cluster on the local machine."""
181
181
182 # Store all logs inside the ipython directory
182 # Store all logs inside the ipython directory
183 ipdir = cutils.get_ipython_dir()
183 ipdir = get_ipython_dir()
184 pjoin = os.path.join
184 pjoin = os.path.join
185
185
186 logfile = opt.logfile
186 logfile = opt.logfile
@@ -256,6 +256,24 b' def clusterLocal(opt,arg):'
256 def clusterRemote(opt,arg):
256 def clusterRemote(opt,arg):
257 """Start a remote cluster over SSH"""
257 """Start a remote cluster over SSH"""
258
258
259 # B. Granger, 9/3/08
260 # The launching of a remote cluster using SSH and a clusterfile
261 # is broken. Because it won't be fixed before the 0.9 release,
262 # we are removing it. For now, we just print a message to the
263 # user and abort.
264
265 print """The launching of a remote IPython cluster using SSL
266 and a clusterfile has been removed in this release.
267 It has been broken for a while and we are in the process
268 of building a new process management system that will be
269 used to provide a more robust way of starting an IPython
270 cluster.
271
272 For now remote clusters have to be launched using ipcontroller
273 and ipengine separately.
274 """
275 sys.exit(1)
276
259 # Load the remote cluster configuration
277 # Load the remote cluster configuration
260 clConfig = {}
278 clConfig = {}
261 execfile(opt.clusterfile,clConfig)
279 execfile(opt.clusterfile,clConfig)
@@ -265,7 +283,7 b' def clusterRemote(opt,arg):'
265 sshx = clConfig.get('sshx',os.environ.get('IPYTHON_SSHX','sshx'))
283 sshx = clConfig.get('sshx',os.environ.get('IPYTHON_SSHX','sshx'))
266
284
267 # Store all logs inside the ipython directory
285 # Store all logs inside the ipython directory
268 ipdir = cutils.get_ipython_dir()
286 ipdir = get_ipython_dir()
269 pjoin = os.path.join
287 pjoin = os.path.join
270
288
271 logfile = opt.logfile
289 logfile = opt.logfile
@@ -311,6 +329,11 b' def clusterRemote(opt,arg):'
311 def main():
329 def main():
312 """Main driver for the two big options: local or remote cluster."""
330 """Main driver for the two big options: local or remote cluster."""
313
331
332 if sys.platform=='win32':
333 print """ipcluster does not work on Microsoft Windows. Please start
334 your IPython cluster using the ipcontroller and ipengine scripts."""
335 sys.exit(1)
336
314 opt,arg = parse_args()
337 opt,arg = parse_args()
315
338
316 clusterfile = opt.clusterfile
339 clusterfile = opt.clusterfile
@@ -105,6 +105,7 b' def start_engine():'
105 # register_engine to tell the controller we are ready to do work
105 # register_engine to tell the controller we are ready to do work
106 engine_connector = EngineConnector(tub_service)
106 engine_connector = EngineConnector(tub_service)
107 furl_file = kernel_config['engine']['furl_file']
107 furl_file = kernel_config['engine']['furl_file']
108 log.msg("Using furl file: %s" % furl_file)
108 d = engine_connector.connect_to_controller(engine_service, furl_file)
109 d = engine_connector.connect_to_controller(engine_service, furl_file)
109 d.addErrback(lambda _: reactor.stop())
110 d.addErrback(lambda _: reactor.stop())
110
111
@@ -245,7 +245,7 b' class IEngineSerializedTestCase(object):'
245 self.assert_(es.IEngineSerialized.providedBy(self.engine))
245 self.assert_(es.IEngineSerialized.providedBy(self.engine))
246
246
247 def testIEngineSerializedInterfaceMethods(self):
247 def testIEngineSerializedInterfaceMethods(self):
248 """Does self.engine have the methods and attributes in IEngireCore."""
248 """Does self.engine have the methods and attributes in IEngineCore."""
249 for m in list(es.IEngineSerialized):
249 for m in list(es.IEngineSerialized):
250 self.assert_(hasattr(self.engine, m))
250 self.assert_(hasattr(self.engine, m))
251
251
@@ -288,7 +288,7 b' class IEngineQueuedTestCase(object):'
288 self.assert_(es.IEngineQueued.providedBy(self.engine))
288 self.assert_(es.IEngineQueued.providedBy(self.engine))
289
289
290 def testIEngineQueuedInterfaceMethods(self):
290 def testIEngineQueuedInterfaceMethods(self):
291 """Does self.engine have the methods and attributes in IEngireQueued."""
291 """Does self.engine have the methods and attributes in IEngineQueued."""
292 for m in list(es.IEngineQueued):
292 for m in list(es.IEngineQueued):
293 self.assert_(hasattr(self.engine, m))
293 self.assert_(hasattr(self.engine, m))
294
294
@@ -326,7 +326,7 b' class IEnginePropertiesTestCase(object):'
326 self.assert_(es.IEngineProperties.providedBy(self.engine))
326 self.assert_(es.IEngineProperties.providedBy(self.engine))
327
327
328 def testIEnginePropertiesInterfaceMethods(self):
328 def testIEnginePropertiesInterfaceMethods(self):
329 """Does self.engine have the methods and attributes in IEngireProperties."""
329 """Does self.engine have the methods and attributes in IEngineProperties."""
330 for m in list(es.IEngineProperties):
330 for m in list(es.IEngineProperties):
331 self.assert_(hasattr(self.engine, m))
331 self.assert_(hasattr(self.engine, m))
332
332
@@ -2,6 +2,7 b''
2 """Windows-specific part of the installation"""
2 """Windows-specific part of the installation"""
3
3
4 import os, sys, shutil
4 import os, sys, shutil
5 pjoin = os.path.join
5
6
6 def mkshortcut(target,description,link_file,*args,**kw):
7 def mkshortcut(target,description,link_file,*args,**kw):
7 """make a shortcut if it doesn't exist, and register its creation"""
8 """make a shortcut if it doesn't exist, and register its creation"""
@@ -11,69 +12,85 b' def mkshortcut(target,description,link_file,*args,**kw):'
11
12
12 def install():
13 def install():
13 """Routine to be run by the win32 installer with the -install switch."""
14 """Routine to be run by the win32 installer with the -install switch."""
14
15
15 from IPython.Release import version
16 from IPython.Release import version
16
17
17 # Get some system constants
18 # Get some system constants
18 prefix = sys.prefix
19 prefix = sys.prefix
19 python = prefix + r'\python.exe'
20 python = pjoin(prefix, 'python.exe')
20 # Lookup path to common startmenu ...
21 ip_dir = get_special_folder_path('CSIDL_COMMON_PROGRAMS') + r'\IPython'
22
21
23 # Some usability warnings at installation time. I don't want them at the
22 # Lookup path to common startmenu ...
24 # top-level, so they don't appear if the user is uninstalling.
23 ip_start_menu = pjoin(get_special_folder_path('CSIDL_COMMON_PROGRAMS'), 'IPython')
25 try:
26 import ctypes
27 except ImportError:
28 print ('To take full advantage of IPython, you need ctypes from:\n'
29 'http://sourceforge.net/projects/ctypes')
30
31 try:
32 import win32con
33 except ImportError:
34 print ('To take full advantage of IPython, you need pywin32 from:\n'
35 'http://starship.python.net/crew/mhammond/win32/Downloads.html')
36
37 try:
38 import readline
39 except ImportError:
40 print ('To take full advantage of IPython, you need readline from:\n'
41 'https://launchpad.net/pyreadline')
42
43 ipybase = '"' + prefix + r'\scripts\ipython"'
44 # Create IPython entry ...
24 # Create IPython entry ...
45 if not os.path.isdir(ip_dir):
25 if not os.path.isdir(ip_start_menu):
46 os.mkdir(ip_dir)
26 os.mkdir(ip_start_menu)
47 directory_created(ip_dir)
27 directory_created(ip_start_menu)
48
28
49 # Create program shortcuts ...
29 # Create .py and .bat files to make things available from
50 f = ip_dir + r'\IPython.lnk'
30 # the Windows command line. Thanks to the Twisted project
51 a = ipybase
31 # for this logic!
52 mkshortcut(python,'IPython',f,a)
32 programs = [
53
33 'ipython',
54 f = ip_dir + r'\pysh.lnk'
34 'iptest',
55 a = ipybase+' -p sh'
35 'ipcontroller',
56 mkshortcut(python,'IPython (command prompt mode)',f,a)
36 'ipengine',
57
37 'ipcluster',
58 f = ip_dir + r'\pylab.lnk'
38 'ipythonx',
59 a = ipybase+' -pylab'
39 'ipython-wx',
60 mkshortcut(python,'IPython (PyLab mode)',f,a)
40 'irunner'
61
41 ]
62 f = ip_dir + r'\scipy.lnk'
42 scripts = pjoin(prefix,'scripts')
63 a = ipybase+' -pylab -p scipy'
43 for program in programs:
64 mkshortcut(python,'IPython (scipy profile)',f,a)
44 raw = pjoin(scripts, program)
65
45 bat = raw + '.bat'
46 py = raw + '.py'
47 # Create .py versions of the scripts
48 shutil.copy(raw, py)
49 # Create .bat files for each of the scripts
50 bat_file = file(bat,'w')
51 bat_file.write("@%s %s %%*" % (python, py))
52 bat_file.close()
53
54 # Now move onto setting the Start Menu up
55 ipybase = pjoin(scripts, 'ipython')
56
57 link = pjoin(ip_start_menu, 'IPython.lnk')
58 cmd = '"%s"' % ipybase
59 mkshortcut(python,'IPython',link,cmd)
60
61 link = pjoin(ip_start_menu, 'pysh.lnk')
62 cmd = '"%s" -p sh' % ipybase
63 mkshortcut(python,'IPython (command prompt mode)',link,cmd)
64
65 link = pjoin(ip_start_menu, 'pylab.lnk')
66 cmd = '"%s" -pylab' % ipybase
67 mkshortcut(python,'IPython (PyLab mode)',link,cmd)
68
69 link = pjoin(ip_start_menu, 'scipy.lnk')
70 cmd = '"%s" -pylab -p scipy' % ipybase
71 mkshortcut(python,'IPython (scipy profile)',link,cmd)
72
73 link = pjoin(ip_start_menu, 'IPython test suite.lnk')
74 cmd = '"%s" -vv' % pjoin(scripts, 'iptest')
75 mkshortcut(python,'Run the IPython test suite',link,cmd)
76
77 link = pjoin(ip_start_menu, 'ipcontroller.lnk')
78 cmd = '"%s" -xy' % pjoin(scripts, 'ipcontroller')
79 mkshortcut(python,'IPython controller',link,cmd)
80
81 link = pjoin(ip_start_menu, 'ipengine.lnk')
82 cmd = '"%s"' % pjoin(scripts, 'ipengine')
83 mkshortcut(python,'IPython engine',link,cmd)
84
66 # Create documentation shortcuts ...
85 # Create documentation shortcuts ...
67 t = prefix + r'\share\doc\ipython\manual\ipython.pdf'
86 t = prefix + r'\share\doc\ipython\manual\ipython.pdf'
68 f = ip_dir + r'\Manual in PDF.lnk'
87 f = ip_start_menu + r'\Manual in PDF.lnk'
69 mkshortcut(t,r'IPython Manual - PDF-Format',f)
88 mkshortcut(t,r'IPython Manual - PDF-Format',f)
70
89
71 t = prefix + r'\share\doc\ipython\manual\html\index.html'
90 t = prefix + r'\share\doc\ipython\manual\html\index.html'
72 f = ip_dir + r'\Manual in HTML.lnk'
91 f = ip_start_menu + r'\Manual in HTML.lnk'
73 mkshortcut(t,'IPython Manual - HTML-Format',f)
92 mkshortcut(t,'IPython Manual - HTML-Format',f)
74
93
75 # make ipython.py
76 shutil.copy(prefix + r'\scripts\ipython', prefix + r'\scripts\ipython.py')
77
94
78 def remove():
95 def remove():
79 """Routine to be run by the win32 installer with the -remove switch."""
96 """Routine to be run by the win32 installer with the -remove switch."""
@@ -115,6 +115,7 b' def find_packages():'
115 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
115 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
116 add_package(packages, 'kernel.core', config=True, tests=True)
116 add_package(packages, 'kernel.core', config=True, tests=True)
117 add_package(packages, 'testing', tests=True)
117 add_package(packages, 'testing', tests=True)
118 add_package(packages, 'tests')
118 add_package(packages, 'testing.plugin', tests=False)
119 add_package(packages, 'testing.plugin', tests=False)
119 add_package(packages, 'tools', tests=True)
120 add_package(packages, 'tools', tests=True)
120 add_package(packages, 'UserConfig')
121 add_package(packages, 'UserConfig')
General Comments 0
You need to be logged in to leave comments. Login now