##// END OF EJS Templates
Jorgen Stenarson's patch (minor mods) to support network shares under win32.
fperez -
Show More
@@ -5,7 +5,7 b' General purpose utilities.'
5 5 This is a grab-bag of stuff I find useful in most programs I write. Some of
6 6 these things are also convenient when working at the command line.
7 7
8 $Id: genutils.py 971 2005-12-29 18:30:45Z fperez $"""
8 $Id: genutils.py 972 2005-12-29 18:45:19Z fperez $"""
9 9
10 10 #*****************************************************************************
11 11 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
@@ -308,6 +308,10 b" def system(cmd,verbose=0,debug=0,header=''):"
308 308 if not debug: stat = os.system(cmd)
309 309 return stat
310 310
311 # This function is used by ipython in a lot of places to make system calls.
312 # We need it to be slightly different under win32, due to the vagaries of
313 # 'network shares'. A win32 override is below.
314
311 315 def shell(cmd,verbose=0,debug=0,header=''):
312 316 """Execute a command in the system shell, always return None.
313 317
@@ -331,6 +335,27 b" def shell(cmd,verbose=0,debug=0,header=''):"
331 335 if not debug:
332 336 os.system(cmd)
333 337
338 # override shell() for win32 to deal with network shares
339 if os.name in ('nt','dos'):
340
341 shell_ori = shell
342
343 def shell(cmd,verbose=0,debug=0,header=''):
344 if os.getcwd().startswith(r"\\"):
345 path = os.getcwd()
346 # change to c drive (cannot be on UNC-share when issuing os.system,
347 # as cmd.exe cannot handle UNC addresses)
348 os.chdir("c:")
349 # issue pushd to the UNC-share and then run the command
350 try:
351 shell_ori('"pushd %s&&"'%path+cmd,verbose,debug,header)
352 finally:
353 os.chdir(path)
354 else:
355 shell_ori('"pushd %s&&"'%path+cmd,verbose,debug,header)
356
357 shell.__doc__ = shell_ori.__doc__
358
334 359 def getoutput(cmd,verbose=0,debug=0,header='',split=0):
335 360 """Dummy substitute for perl's backquotes.
336 361
@@ -1,5 +1,8 b''
1 1 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2 2
3 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
4 (minor mods) to support network shares under win32.
5
3 6 * IPython/winconsole.py (get_console_size): add new winconsole
4 7 module and fixes to page_dumb() to improve its behavior under
5 8 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
General Comments 0
You need to be logged in to leave comments. Login now