@@ -319,8 +319,8 @@ def create_launcher(self, name, icon, command=None,
319319
320320 build_nsis ('launcher.nsi' , fname , data )
321321
322- def create_python_batch (self , name , package_dir , script_name ,
323- options = None ):
322+ def create_python_batch (self , name , script_name ,
323+ workdir = None , options = None ):
324324 """Create batch file to run a Python script"""
325325 if options is None :
326326 options = ''
@@ -330,12 +330,16 @@ def create_python_batch(self, name, package_dir, script_name,
330330 cmd = 'start %WINPYDIR%\pythonw.exe'
331331 else :
332332 cmd = '%WINPYDIR%\python.exe'
333+ changedir = ''
334+ if workdir is not None :
335+ workdir = osp .join ('%WINPYDIR%' , workdir )
336+ changedir = r"""cd %s
337+ """ % workdir
333338 if script_name :
334339 script_name = ' ' + script_name
335340 self .create_batch_script (name , r"""@echo off
336341call %~dp0env.bat
337- cd %WINPYDIR%""" + package_dir + r"""
338- """ + cmd + script_name + options + " %*" )
342+ """ + changedir + cmd + script_name + options + " %*" )
339343
340344 def create_installer (self ):
341345 """Create installer with NSIS"""
@@ -501,19 +505,19 @@ def _create_batch_scripts(self):
501505 self .create_batch_script ('cmd.bat' , r"""@echo off
502506call %~dp0env.bat
503507cmd.exe /k""" )
504- self .create_python_batch ('python.bat' , '' , '' )
505- self .create_python_batch ('spyder.bat' , r'\Scripts ' , 'spyder ' )
506- self .create_python_batch ('spyder_light.bat' , r'\Scripts' , 'spyder' ,
507- options = '--light' )
508- self .create_python_batch ('register_python.bat' ,
509- r'\ Scripts' , 'register_python ' )
508+ self .create_python_batch ('python.bat' , '' )
509+ self .create_python_batch ('spyder.bat' , 'spyder ' , workdir = 'Scripts ' )
510+ self .create_python_batch ('spyder_light.bat' , 'spyder' ,
511+ workdir = 'Scripts' , options = '--light' )
512+ self .create_python_batch ('register_python.bat' , 'register_python' ,
513+ workdir = ' Scripts' )
510514 self .create_batch_script ('register_python_for_all.bat' ,
511515 r"""@echo off
512516call %~dp0env.bat
513517call %~dp0register_python.bat --all""" )
514- self .create_python_batch ('wpcp.bat' , r'\Scripts ' , 'wpcp ' )
515- self .create_python_batch ('pyqt_demo.bat' ,
516- r'\ Lib\site-packages\PyQt4\examples\demos\qtdemo' , 'qtdemo.pyw ' )
518+ self .create_python_batch ('wpcp.bat' , 'wpcp ' , workdir = 'Scripts ' )
519+ self .create_python_batch ('pyqt_demo.bat' , 'qtdemo.pyw' ,
520+ workdir = r' Lib\site-packages\PyQt4\examples\demos\qtdemo' )
517521 self ._print_done ()
518522
519523 def make (self , remove_existing = True ):
0 commit comments