@@ -546,6 +546,10 @@ def _create_batch_scripts_initial(self):
546
546
self ._print ("Creating batch scripts initial" )
547
547
conv = lambda path : ";" .join (['%WINPYDIR%\\ ' + pth for pth in path ])
548
548
path = conv (self .prepath ) + ";%PATH%;" + conv (self .postpath )
549
+
550
+ convps = lambda path : ";" .join (['$env:WINPYDIR\\ ' + pth for pth in path ])
551
+ pathps = convps (self .prepath ) + ";$env:path;" + convps (self .postpath )
552
+
549
553
self .create_batch_script ('env.bat' , r"""@echo off
550
554
set WINPYDIR=%~dp0..""" + "\\ " + self .python_name + r"""
551
555
set WINPYVER=""" + self .winpyver + r"""
@@ -595,6 +599,90 @@ def _create_batch_scripts_initial(self):
595
599
echo #JUPYTER_DATA_DIR = %%HOME%%>>"%winpython_ini%"
596
600
echo #WINPYWORKDIR = %%HOMEDRIVE%%%%HOMEPATH%%\Documents\WinPython%%WINPYVER%%\Notebooks>>"%winpython_ini%"
597
601
)
602
+ """ )
603
+
604
+ self .create_batch_script ('WinPython_PS_Prompt.ps1' , r"""
605
+ ###############################
606
+ ### WinPython_PS_Prompt.ps1 ###
607
+ ###############################
608
+
609
+
610
+ $env:WINPYDIR = '$pwd\..""" + '\\ ' + self .python_name + r"""'
611
+ $env:WINPYVER = '""" + self .winpyver + r"""'
612
+ $env:HOME = '$env:WINPYDIR\..\settings'
613
+ $env:JUPYTER_DATA_DIR = '$env:HOME'
614
+ $env:WINPYARCH = 'WIN32'
615
+ if ($env:WINPYARCH.subString($env:WINPYARCH.length-5, 5) -eq 'amd64') {
616
+ $env:WINPYARCH = 'WIN-AMD64' }
617
+
618
+ if (-not $env:PATH.ToLower().Contains(";"+ $env:WINPYDIR.ToLower()+ ";")) {
619
+ $env:PATH = '""" + pathps + r"""' }
620
+
621
+ #rem force default pyqt5 kit for Spyder if PyQt5 module is there
622
+ if (Test-Path "$env:WINPYDIR\Lib\site-packages\PyQt5") { $env:QT_API = "pyqt5" }
623
+
624
+
625
+ ###############################
626
+ ### Set-WindowSize
627
+ ###############################
628
+ Function Set-WindowSize {
629
+ Param([int]$x=$host.ui.rawui.windowsize.width,
630
+ [int]$y=$host.ui.rawui.windowsize.heigth,
631
+ [int]$buffer=$host.UI.RawUI.BufferSize.heigth)
632
+
633
+ $buffersize = new-object System.Management.Automation.Host.Size($x,$buffer)
634
+ $host.UI.RawUI.BufferSize = $buffersize
635
+ $size = New-Object System.Management.Automation.Host.Size($x,$y)
636
+ $host.ui.rawui.WindowSize = $size
637
+ }
638
+
639
+ Set-WindowSize 150 40 6000
640
+
641
+ ### Colorize to distinguish
642
+ $host.ui.RawUI.BackgroundColor = "DarkBlue"
643
+ $host.ui.RawUI.ForegroundColor = "White"
644
+
645
+
646
+ #####################
647
+ ### handle R if included
648
+ #####################
649
+ if (Test-Path "$env:WINPYDIR\..\tools\R\bin") {
650
+ $env:R_HOME = "$env:WINPYDIR\..\tools\R"
651
+ $env:R_HOMEbin = "$env:R_HOME\bin\x64"
652
+ if ("$env:WINPYARCH" -eq "WIN32") {
653
+ $env:R_HOMEbin = "$env:R_HOME\bin\i386"
654
+ }
655
+ }
656
+
657
+ #####################
658
+ ### handle Julia if included
659
+ #####################
660
+ if (Test-Path "$env:WINPYDIR\..\tools\Julia\bin") {
661
+ $env:JULIA_HOME = "$env:WINPYDIR\..\tools\Julia\bin\"
662
+ $env:JULIA_EXE = "julia.exe"
663
+ $env:JULIA = "$env:JULIA_HOME$env:JULIA_EXE"
664
+ $env:JULIA_PKGDIR = "$env:WINPYDIR\..\settings\.julia"
665
+ }
666
+
667
+ #####################
668
+ ### WinPython.ini part (removed from nsis)
669
+ #####################
670
+ if (-not (Test-Path "$env:WINPYDIR\..\settings")) { md -Path "$env:WINPYDIR\..\settings" }
671
+ $env:winpython_ini = "$env:WINPYDIR\..\settings\winpython.ini"
672
+ if (-not (Test-Path $env:winpython_ini)) {
673
+ "[debug]" | Add-Content -Path $env:winpython_ini
674
+ "state = disabled" | Add-Content -Path $env:winpython_ini
675
+ "[environment]" | Add-Content -Path $env:winpython_ini
676
+ "## <?> Uncomment lines to override environment variables" | Add-Content -Path $env:winpython_ini
677
+ "#HOME = %%HOMEDRIVE%%%%HOMEPATH%%\Documents\WinPython%%WINPYVER%%" | Add-Content -Path $env:winpython_ini
678
+ "#JUPYTER_DATA_DIR = %%HOME%%" | Add-Content -Path $env:winpython_ini
679
+ "#WINPYWORKDIR = %%HOMEDRIVE%%%%HOMEPATH%%\Documents\WinPython%%WINPYVER%%\Notebooks" | Add-Content -Path $env:winpython_ini
680
+ }
681
+ """ )
682
+
683
+ self .create_batch_script ('WinPython_Interpreter_PS.bat' , r"""@echo off
684
+ rem call "%~dp0env_for_icons.bat"
685
+ Powershell.exe -executionpolicy RemoteSigned -noexit -file "%~dp0WinPython_PS_Prompt.ps1"
598
686
""" )
599
687
600
688
self .create_batch_script ('env_for_icons.bat' , r"""@echo off
@@ -766,6 +854,7 @@ def _create_batch_scripts(self):
766
854
self .create_batch_script ('cmd.bat' , r"""@echo off
767
855
call "%~dp0env_for_icons.bat"
768
856
cmd.exe /k""" )
857
+
769
858
self .create_batch_script ('python.bat' ,r"""@echo off
770
859
call "%~dp0env_for_icons.bat"
771
860
cd/D "%WINPYWORKDIR%"
0 commit comments