@@ -487,6 +487,9 @@ def _create_launchers(self):
487
487
self .create_launcher ('WinPython Command Prompt.exe' , 'cmd.ico' ,
488
488
command = '$SYSDIR\cmd.exe' ,
489
489
args = r'/k cmd.bat' )
490
+ self .create_launcher ('WinPython Powershell Prompt.exe' , 'powershell.ico' ,
491
+ command = '$SYSDIR\cmd.exe' ,
492
+ args = r'/k cmd_ps.bat' )
490
493
491
494
self .create_launcher ('WinPython Interpreter.exe' , 'python.ico' ,
492
495
command = '$SYSDIR\cmd.exe' ,
@@ -547,7 +550,7 @@ def _create_batch_scripts_initial(self):
547
550
conv = lambda path : ";" .join (['%WINPYDIR%\\ ' + pth for pth in path ])
548
551
path = conv (self .prepath ) + ";%PATH%;" + conv (self .postpath )
549
552
550
- convps = lambda path : ";" .join ([' $env:WINPYDIR\\ ' + pth for pth in path ])
553
+ convps = lambda path : ";" .join ([" $env:WINPYDIR\\ " + pth for pth in path ])
551
554
pathps = convps (self .prepath ) + ";$env:path;" + convps (self .postpath )
552
555
553
556
self .create_batch_script ('env.bat' , r"""@echo off
@@ -605,43 +608,31 @@ def _create_batch_scripts_initial(self):
605
608
###############################
606
609
### WinPython_PS_Prompt.ps1 ###
607
610
###############################
611
+ $0 = $myInvocation.MyCommand.Definition
612
+ $dp0 = [System.IO.Path]::GetDirectoryName($0)
613
+
614
+ # avoid double_init (will only resize screen)
615
+ if (-not $env:WINPYDIR -eq "$dp0\..\python-3.4.4.amd64") {
608
616
617
+ # $env:WINPYDIR = '$pwd\..\python-3.4.4.amd64'
618
+ $env:WINPYDIR = "$dp0\..\python-3.4.4.amd64"
609
619
610
- $env:WINPYDIR = '$pwd \..""" + '\\ ' + self .python_name + r"""'
620
+ $env:WINPYDIR = "$dp0 \..""" + '\\ ' + self .python_name + '"' + r"""
611
621
$env:WINPYVER = '""" + self .winpyver + r"""'
612
- $env:HOME = ' $env:WINPYDIR\..\settings'
613
- $env:JUPYTER_DATA_DIR = ' $env:HOME'
622
+ $env:HOME = " $env:WINPYDIR\..\settings"
623
+ $env:JUPYTER_DATA_DIR = " $env:HOME"
614
624
$env:WINPYARCH = 'WIN32'
615
625
if ($env:WINPYARCH.subString($env:WINPYARCH.length-5, 5) -eq 'amd64') {
616
626
$env:WINPYARCH = 'WIN-AMD64' }
617
627
628
+
618
629
if (-not $env:PATH.ToLower().Contains(";"+ $env:WINPYDIR.ToLower()+ ";")) {
619
- $env:PATH = ' """ + pathps + r"""' }
630
+ $env:PATH = """ + '"' + pathps + '"' + r""" }
620
631
621
632
#rem force default pyqt5 kit for Spyder if PyQt5 module is there
622
633
if (Test-Path "$env:WINPYDIR\Lib\site-packages\PyQt5") { $env:QT_API = "pyqt5" }
623
634
624
635
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
636
646
637
#####################
647
638
### handle R if included
@@ -678,10 +669,39 @@ def _create_batch_scripts_initial(self):
678
669
"#JUPYTER_DATA_DIR = %%HOME%%" | Add-Content -Path $env:winpython_ini
679
670
"#WINPYWORKDIR = %%HOMEDRIVE%%%%HOMEPATH%%\Documents\WinPython%%WINPYVER%%\Notebooks" | Add-Content -Path $env:winpython_ini
680
671
}
672
+
673
+
674
+ }
675
+ ###############################
676
+ ### Set-WindowSize
677
+ ###############################
678
+ Function Set-WindowSize {
679
+ Param([int]$x=$host.ui.rawui.windowsize.width,
680
+ [int]$y=$host.ui.rawui.windowsize.heigth,
681
+ [int]$buffer=$host.UI.RawUI.BufferSize.heigth)
682
+
683
+ $buffersize = new-object System.Management.Automation.Host.Size($x,$buffer)
684
+ $host.UI.RawUI.BufferSize = $buffersize
685
+ $size = New-Object System.Management.Automation.Host.Size($x,$y)
686
+ $host.ui.rawui.WindowSize = $size
687
+ }
688
+
689
+ Set-WindowSize 150 40 6000
690
+
691
+ ### Colorize to distinguish
692
+ $host.ui.RawUI.BackgroundColor = "DarkBlue"
693
+ $host.ui.RawUI.ForegroundColor = "White"
694
+
681
695
""" )
682
696
697
+ self .create_batch_script ('cmd_ps.bat' , r"""@echo off
698
+ rem safe bet
699
+ call "%~dp0env_for_icons.bat"
700
+ Powershell.exe -executionpolicy RemoteSigned -noexit -file "%~dp0WinPython_PS_Prompt.ps1"
701
+ """ )
702
+
683
703
self .create_batch_script ('WinPython_Interpreter_PS.bat' , r"""@echo off
684
- rem call "%~dp0env_for_icons.bat"
704
+ rem no safe bet (for comparisons)
685
705
Powershell.exe -executionpolicy RemoteSigned -noexit -file "%~dp0WinPython_PS_Prompt.ps1"
686
706
""" )
687
707
0 commit comments