@@ -311,7 +311,8 @@ def create_batch_script(self, name, contents):
311
311
312
312
def create_launcher (self , name , icon , command = None ,
313
313
args = None , workdir = None , settingspath = None ,
314
- bettercommand = None , betterworkdir = None , betterargs = None ):
314
+ bettercommand = None , betterworkdir = None , betterargs = None ,
315
+ launcher = 'launcher.nsi' ):
315
316
"""Create exe launcher with NSIS"""
316
317
assert name .endswith ('.exe' )
317
318
portable_dir = osp .join (osp .dirname (osp .abspath (__file__ )), 'portable' )
@@ -365,7 +366,7 @@ def create_launcher(self, name, icon, command=None,
365
366
data += [('SETTINGSDIR' , osp .dirname (settingspath )),
366
367
('SETTINGSNAME' , osp .basename (settingspath ))]
367
368
368
- build_nsis (' launcher.nsi' , fname , data )
369
+ build_nsis (launcher , fname , data )
369
370
370
371
def create_python_batch (self , name , script_name ,
371
372
workdir = None , options = None , command = None ):
@@ -513,6 +514,8 @@ def _copy_dev_docs(self):
513
514
514
515
def _create_launchers (self ):
515
516
"""Create launchers"""
517
+
518
+
516
519
self ._print ("Creating launchers" )
517
520
self .create_launcher ('WinPython Command Prompt.exe' , 'cmd.ico' ,
518
521
command = '$SYSDIR\cmd.exe' ,
@@ -526,13 +529,13 @@ def _create_launchers(self):
526
529
self .create_launcher ('IDLEX (Python GUI).exe' , 'python.ico' ,
527
530
args = 'idlex.pyw' ,
528
531
workdir = '${WINPYDIR}\Scripts' )
529
- settingspath = osp .join ('.spyder2' , '.spyder.ini' )
532
+ settingspath = osp .join ('.spyder-py3' , '. spyder2' , '.spyder.ini' )
530
533
self .create_launcher ('Spyder.exe' , 'spyder.ico' ,
531
534
command = '${WINPYDIR}\python.exe' ,
532
535
args = '-m spyderlib.start_app' ,
533
536
workdir = '${WINPYDIR}\Scripts' ,
534
537
settingspath = settingspath )
535
- self .create_launcher ('Spyder ( reset) .exe' , 'spyder_reset.ico' ,
538
+ self .create_launcher ('Spyder reset.exe' , 'spyder_reset.ico' ,
536
539
command = '${WINPYDIR}\python.exe' ,
537
540
args = '-m spyderlib.start_app --reset' ,
538
541
workdir = '${WINPYDIR}\Scripts' ,
@@ -572,35 +575,71 @@ def _create_launchers(self):
572
575
bettercommand = Qt5_dir + r'\linguist.exe' )
573
576
574
577
# Jupyter launchers
575
- if osp .isfile (osp .join (self .python_dir , 'Scripts' , 'jupyter.exe' )):
576
- self .create_launcher ('IPython Qt Console.exe' , 'ipython.ico' ,
578
+ self .create_launcher ('IPython Qt Console.exe' , 'ipython.ico' ,
577
579
command = '${WINPYDIR}\Scripts\%s' %
578
580
'jupyter-qtconsole.exe' ,
579
- workdir = r'${WINPYDIR}\.. \notebooks' )
581
+ workdir = r'$EXEDIR \notebooks' )
580
582
581
- self .create_launcher ('Jupyter Notebook.exe' , 'jupyter.ico' ,
583
+ self .create_launcher ('Jupyter Notebook.exe' , 'jupyter.ico' ,
582
584
command = '${WINPYDIR}\Scripts\%s' %
583
585
'jupyter-notebook.exe' ,
584
- workdir = r'${WINPYDIR}\.. \notebooks' )
586
+ workdir = r'$EXEDIR \notebooks' )
585
587
586
588
# R console launchers
587
589
r_exe = self .R_PATH + r"\i386\R.exe"
588
590
if osp .isfile (self .winpydir + r_exe ):
589
591
self .create_launcher ('R Console32.exe' , 'r.ico' ,
590
- command = '${WINPYDIR}\.. ' + r_exe ,
591
- workdir = r'${WINPYDIR}\.. \notebooks' )
592
+ command = '$EXEDIR ' + r_exe ,
593
+ workdir = r'$EXEDIR \notebooks' )
592
594
r_exe = self .R_PATH + r"\x64\R.exe"
593
595
if osp .isfile (self .winpydir + r_exe ):
594
596
self .create_launcher ('R Console64.exe' , 'r.ico' ,
595
- command = '${WINPYDIR}\.. ' + r_exe ,
596
- workdir = r'${WINPYDIR}\.. \notebooks' )
597
+ command = '$EXEDIR ' + r_exe ,
598
+ workdir = r'$EXEDIR \notebooks' )
597
599
598
600
# Julia console launcher
599
601
julia_exe = self .JULIA_PATH + r"\julia.exe"
600
602
if osp .isfile (self .winpydir + julia_exe ):
601
603
self .create_launcher ('Julia Console.exe' , 'julia.ico' ,
602
- command = '${WINPYDIR}\..' + julia_exe ,
603
- workdir = r'${WINPYDIR}\..\notebooks' )
604
+ command = '$EXEDIR' + julia_exe ,
605
+ workdir = r'$EXEDIR\notebooks' )
606
+
607
+ # ******* Student Experiment (start)
608
+
609
+ #self.create_launcher('IDLEX (students).exe', 'python.ico',
610
+ # command='$SYSDIR\cmd.exe',
611
+ # args= r'/k IDLEX_for_student.bat %*',
612
+ # workdir='$EXEDIR\scripts')
613
+ self .create_launcher ('IDLEX (student).exe' , 'python.ico' ,
614
+ command = 'wscript.exe' ,
615
+ args = r'Noshell.vbs IDLEX_for_student.bat' ,
616
+ workdir = '$EXEDIR\scripts' ,
617
+ launcher = 'launcher_basic.nsi' )
618
+
619
+ self .create_launcher ('Spyder (student).exe' , 'spyder.ico' ,
620
+ command = 'wscript.exe' ,
621
+ args = r'Noshell.vbs spyder_for_student.bat' ,
622
+ workdir = '$EXEDIR\Scripts' ,
623
+ launcher = 'launcher_basic.nsi' )
624
+
625
+ self .create_launcher ('Spyder reset (student).exe' , 'spyder_reset.ico' ,
626
+ command = 'wscript.exe' ,
627
+ args = r'Noshell.vbs spyder_for_student.bat' ,
628
+ workdir = '$EXEDIR\Scripts' ,
629
+ launcher = 'launcher_basic.nsi' )
630
+
631
+ self .create_launcher ('IPython Qt Console (student).exe' , 'ipython.ico' ,
632
+ command = 'wscript.exe' ,
633
+ args = r'Noshell.vbs qtconsole_for_student.bat' ,
634
+ workdir = '$EXEDIR\Scripts' ,
635
+ launcher = 'launcher_basic.nsi' )
636
+
637
+ # this one needs a shell to kill fantom processes
638
+ self .create_launcher ('Jupyter Notebook (student).exe' , 'jupyter.ico' ,
639
+ command = '$SYSDIR\cmd.exe' ,
640
+ args = r'/k ipython_notebook_for_student.bat' ,
641
+ workdir = '$EXEDIR\Scripts' ,
642
+ launcher = 'launcher_basic.nsi' )
604
643
605
644
self ._print_done ()
606
645
@@ -639,6 +678,51 @@ def _create_batch_scripts_initial(self):
639
678
rem keep nbextensions in Winpython directory, rather then %APPDATA% default
640
679
set JUPYTER_DATA_DIR=%WINPYDIR%\..\settings
641
680
""" )
681
+
682
+ self .create_batch_script ('env_for_student.bat' , r"""
683
+ @echo off
684
+ rem to have WinPython working in a local account
685
+ if "%WINPYDIR%"=="" call %~dp0env.bat
686
+
687
+ rem ******* Classic WinPython *******
688
+ rem set JUPYTER_DATA_DIR=%WINPYDIR%\..\settings
689
+ rem set HOME=%WINPYDIR%\..\settings
690
+
691
+ rem ******* Student WinPython *******
692
+ set HOME=%HOMEDRIVE%%HOMEPATH%\Documents\WinPython%WINPYVER%
693
+ set JUPYTER_DATA_DIR=%HOME%
694
+
695
+ if not exist "%HOME%\Notebooks" mkdir "%HOME%\Notebooks"
696
+
697
+ if exist "%HOME%\Notebooks\docs" goto ok_docs
698
+ mkdir "%HOME%\Notebooks\docs"
699
+ xcopy /i "%WINPYDIR%\..\Notebooks\docs\*.ipynb" "%HOME%\Notebooks\docs"
700
+ :ok_docs
701
+
702
+
703
+ if not exist "%HOME%\.spyder-py%WINPYVER:~0,1%" mkdir "%HOME%\.spyder-py%WINPYVER:~0,1%"
704
+ if not exist "%HOME%\.spyder-py%WINPYVER:~0,1%\workingdir" echo %HOME%\Notebooks>"%HOME%\.spyder-py%WINPYVER:~0,1%\workingdir"
705
+
706
+ rem ******* make cython use mingwpy part *******
707
+ if not exist "%HOME%\pydistutils.cfg" xcopy "%WINPYDIR%\..\settings\pydistutils.cfg" "%HOME%"
708
+ """ )
709
+
710
+ self .create_batch_script ('Noshell.vbs' ,
711
+ r"""
712
+ 'from http://superuser.com/questions/140047/how-to-run-a-batch-file-without-launching-a-command-window/390129
713
+ If WScript.Arguments.Count >= 1 Then
714
+ ReDim arr(WScript.Arguments.Count-1)
715
+ For i = 0 To WScript.Arguments.Count-1
716
+ Arg = WScript.Arguments(i)
717
+ If InStr(Arg, " ") > 0 Then Arg = chr(34) & Arg & chr(34)
718
+ arr(i) = Arg
719
+ Next
720
+
721
+ RunCmd = Join(arr)
722
+ CreateObject("Wscript.Shell").Run RunCmd, 0 , True
723
+ End If
724
+ """ )
725
+
642
726
643
727
def _create_batch_scripts (self ):
644
728
"""Create batch scripts"""
@@ -708,6 +792,7 @@ def _create_batch_scripts(self):
708
792
call %~dp0env.bat
709
793
cmd.exe /k""" )
710
794
self .create_python_batch ('python.bat' , '' )
795
+
711
796
self .create_python_batch ('spyder.bat' , 'spyderlib.start_app' ,
712
797
workdir = 'Scripts' ,
713
798
command = '%WINPYDIR%\python.exe -m' )
@@ -742,6 +827,41 @@ def _create_batch_scripts(self):
742
827
pause
743
828
""" )
744
829
830
+ # ******* Student Experiment (start)
831
+ self .create_batch_script ('idlex_for_student.bat' ,r"""@echo off
832
+ call "%~dp0env_for_student.bat"
833
+ cd/D "%HOME%\Notebooks"
834
+ "%WINPYDIR%\python.exe" "%WINPYDIR%\scripts\idlex.pyw" %*
835
+ """ )
836
+
837
+ self .create_batch_script ('spyder_for_student.bat' ,r"""@echo off
838
+ call "%~dp0env_for_student.bat"
839
+ cd/D "%HOME%\Notebooks"
840
+ "%WINPYDIR%\python.exe" -m spyderlib.start_app %*
841
+ """ )
842
+ self .create_batch_script ('spyder_reset_for_student.bat' ,r"""@echo off
843
+ call "%~dp0env_for_student.bat"
844
+ cd/D "%HOME%\Notebooks"
845
+ %WINPYDIR%\python.exe -m spyderlib.start_app --reset %*
846
+ echo %HOME%\Notebooks>"%HOME%\.spyder-py%WINPYVER:~0,1%\workingdir"
847
+ rem legacy if ever needed
848
+ echo %HOME%\Notebooks>"%HOME%\.spyder2\workingdir"
849
+ echo %HOME%\Notebooks>"%HOME%\.spyder\workingdir"
850
+ """ )
851
+
852
+ self .create_batch_script ('ipython_notebook_for_student.bat' ,r"""@echo off
853
+ call "%~dp0env_for_student.bat"
854
+ cd/D "%HOME%\Notebooks"
855
+ "%WINPYDIR%\scripts\jupyter-notebook.exe" --notebook-dir="%HOME%\Notebooks" %*
856
+ """ )
857
+
858
+ self .create_batch_script ('qtconsole_for_student.bat' ,r"""@echo off
859
+ call "%~dp0env_for_student.bat"
860
+ cd/D "%HOME%\Notebooks"
861
+ "%WINPYDIR%\scripts\jupyter-qtconsole.exe" %*
862
+ """ )
863
+ # ******* Student Experiment (end)
864
+
745
865
# pre-run mingw batch
746
866
print ('now pre-running extra mingw' )
747
867
filepath = osp .join (self .winpydir , 'scripts' , 'make_cython_use_mingw.bat' )
0 commit comments