#NEWLINE# def _create_batch_scripts_initial( self ) : #NEWLINE# #INDENT# 'Create batch scripts' #NEWLINE# self . _print ( 'Creating batch scripts initial' ) #NEWLINE# conv = ( lambda path : ';' . join ( [ ( '%WINPYDIR%\\' + pth ) for pth in path ] ) ) #NEWLINE# path = ( ( conv ( self . prepath ) + ';%PATH%;' ) + conv ( self . postpath ) ) #NEWLINE# self . create_batch_script ( 'env.bat' , ( ( ( ( ( ( ( '@echo off\nset WINPYDIR=%~dp0..' + '\\' ) + path . python_name ) + '\nset WINPYVER=' ) + self . winpyver ) + '\nset HOME=%~dp0..\\settings\nset WINPYARCH=WIN32\nif  "%WINPYDIR:~-5%"=="amd64" set WINPYARCH=WIN-AMD64\necho ;%PATH%; | find /C /I ";%WINPYDIR%\\;" >nul\nif %ERRORLEVEL% NEQ 0 set PATH=' ) + path ) + '\n\nrem force default pyqt5 kit for Spyder if PyQt5 module is there\nif exist "%WINPYDIR%\\Lib\\site-packages\\PyQt5" set QT_API=pyqt5\n\nrem ******************\nrem handle R if included\nrem ******************\nif exist "%WINPYDIR%\\..\\tools\\R\\bin" (\n    set R_HOME=%WINPYDIR%\\..\\tools\\R\n    if "%WINPYARCH%"=="WIN32" (\n        set R_HOMEbin=%R_HOME%\\bin\\i386\n    ) else (\n        set R_HOMEbin=%R_HOME%\\bin\\x64\n    )\n)\n\nrem ******************\nrem handle Julia if included\nrem ******************\nif exist "%WINPYDIR%\\..\\tools\\Julia\\bin" (\n    set JULIA_HOME=%WINPYDIR%\\..\\tools\\Julia\\bin\\\n    set JULIA_EXE=julia.exe\n    set JULIA=%JULIA_HOME%%JULIA_EXE%\n    set JULIA_PKGDIR=%WINPYDIR%\\..\\settings\\.julia\n)\n\nrem ******************\nrem WinPython.ini part (removed from nsis)\nrem ******************\nif not exist "%WINPYDIR%\\..\\settings" mkdir "%WINPYDIR%\\..\\settings" \nset winpython_ini=%WINPYDIR%\\..\\settings\\winpython.ini\nif not exist "%winpython_ini%" (\n    echo [debug]>>"%winpython_ini%"\n    echo state = disabled>>"%winpython_ini%"\n    echo [environment]>>"%winpython_ini%"\n    echo ## <?> Uncomment lines to override environment variables>>"%winpython_ini%"\n    echo #HOME = %%HOMEDRIVE%%%%HOMEPATH%%\\Documents\\WinPython%%WINPYVER%%>>"%winpython_ini%"\n    echo #JUPYTER_DATA_DIR = %%HOME%%>>"%winpython_ini%"\n    echo #WINPYWORKDIR = %%HOMEDRIVE%%%%HOMEPATH%%\\Documents\\WinPython%%WINPYVER%%\\Notebooks>>"%winpython_ini%"\n)\n' ) ) #NEWLINE# self . create_batch_script ( 'env_for_icons.bat' , '@echo off\ncall %~dp0env.bat\nset WINPYWORKDIR=%~dp0..\\Notebooks\nFOR /F "delims=" %%i IN (\'cscript /nologo "%~dp0WinpythonIni.vbs"\') DO set winpythontoexec=%%i\n%winpythontoexec%set winpythontoexec=\n\nrem ******************\nrem missing student directory part\nrem ******************\n\nif not exist "%WINPYWORKDIR%" mkdir "%WINPYWORKDIR%"\n\nif not exist "%HOME%\\.spyder-py%WINPYVER:~0,1%"  mkdir "%HOME%\\.spyder-py%WINPYVER:~0,1%"\nif not exist "%HOME%\\.spyder-py%WINPYVER:~0,1%\\workingdir" echo %HOME%\\Notebooks>"%HOME%\\.spyder-py%WINPYVER:~0,1%\\workingdir"\n\nrem ******* make cython use mingwpy part *******\nif not exist "%WINPYDIR%\\..\\settings\\pydistutils.cfg" goto no_cython\nif not exist "%HOME%\\pydistutils.cfg" xcopy   "%WINPYDIR%\\..\\settings\\pydistutils.cfg" "%HOME%" \n:no_cython \n' ) #NEWLINE# self . create_batch_script ( 'Noshell.vbs' , '\n\'from http://superuser.com/questions/140047/how-to-run-a-batch-file-without-launching-a-command-window/390129\nIf WScript.Arguments.Count >= 1 Then\n    ReDim arr(WScript.Arguments.Count-1)\n    For i = 0 To WScript.Arguments.Count-1\n        Arg = WScript.Arguments(i)\n        If InStr(Arg, " ") > 0 Then Arg = chr(34) & Arg & chr(34)\n      arr(i) = Arg\n    Next\n\n    RunCmd = Join(arr)\n    CreateObject("Wscript.Shell").Run RunCmd, 0 , True\nEnd If\n        ' ) #NEWLINE# self . create_batch_script ( 'WinPythonIni.vbs' , '\nSet colArgs = WScript.Arguments\nIf colArgs.Count> 0 Then \n  Filename=colArgs(0) \nelse \n  Filename="..\\settings\\winpython.ini"\nend if\nmy_lines = Split(GetFile(FileName) & vbNewLine , vbNewLine )\nsegment = "environment"\ntxt=""\nSet objWSH =  CreateObject("WScript.Shell")\nFor each l in my_lines\n    if left(l, 1)="[" then\n        segment=split(mid(l, 2, 999) & "]","]")(0)\n    ElseIf left(l, 1) <> "#" and instr(l, "=")>0  then\n        data = Split(l & "=", "=")\n        if segment="debug" and trim(data(0))="state" then data(0)= "WINPYDEBUG"\n        if segment="environment" or segment= "debug" then \n            txt= txt & "set " & rtrim(data(0)) & "=" & translate(ltrim(data(1))) & "&& "\n            objWSH.Environment("PROCESS").Item(rtrim(data(0))) = translate(ltrim(data(1)))\n        end if\n        if segment="debug" and trim(data(0))="state" then txt= txt & "set WINPYDEBUG=" & trim(data(1)) & "&&"\n    End If\nNext\nwscript.echo txt\n\n\nFunction GetFile(ByVal FileName)\n    Set FS = CreateObject("Scripting.FileSystemObject")\n    If Left(FileName,3)="..\\" then FileName = FS.GetParentFolderName(FS.GetParentFolderName(Wscript.ScriptFullName)) & mid(FileName,3,9999)\n    If Left(FileName,3)=".\\" then FileName = FS.GetParentFolderName(FS.GetParentFolderName(Wscript.ScriptFullName)) & mid(FileName,3,9999)\n    On Error Resume Next\n    GetFile = FS.OpenTextFile(FileName).ReadAll\nEnd Function\n\nFunction translate(line)\n    set dos = objWSH.Environment("PROCESS")\n    tab = Split(line & "%", "%")\n    for i = 1 to Ubound(tab) step 2   \n       if tab(i)& "" <> "" and dos.Item(tab(i)) & "" <> "" then tab(i) =  dos.Item(tab(i))\n    next\n    translate =  Join(tab, "") \nend function\n        ' )