Skip to content

Commit d8b3a0a

Browse files
committed
Merge pull request #338 from stonebig/master
powershell console step1
2 parents 3db4bc8 + f8e8209 commit d8b3a0a

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed

make.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,10 @@ def _create_batch_scripts_initial(self):
546546
self._print("Creating batch scripts initial")
547547
conv = lambda path: ";".join(['%WINPYDIR%\\'+pth for pth in path])
548548
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+
549553
self.create_batch_script('env.bat', r"""@echo off
550554
set WINPYDIR=%~dp0.."""+"\\" + self.python_name + r"""
551555
set WINPYVER=""" + self.winpyver + r"""
@@ -595,6 +599,90 @@ def _create_batch_scripts_initial(self):
595599
echo #JUPYTER_DATA_DIR = %%HOME%%>>"%winpython_ini%"
596600
echo #WINPYWORKDIR = %%HOMEDRIVE%%%%HOMEPATH%%\Documents\WinPython%%WINPYVER%%\Notebooks>>"%winpython_ini%"
597601
)
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"
598686
""")
599687

600688
self.create_batch_script('env_for_icons.bat', r"""@echo off
@@ -766,6 +854,7 @@ def _create_batch_scripts(self):
766854
self.create_batch_script('cmd.bat', r"""@echo off
767855
call "%~dp0env_for_icons.bat"
768856
cmd.exe /k""")
857+
769858
self.create_batch_script('python.bat',r"""@echo off
770859
call "%~dp0env_for_icons.bat"
771860
cd/D "%WINPYWORKDIR%"

portable/icons/powershell.ico

79 KB
Binary file not shown.

winpython/data/packages.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ description=Cross-platform colored terminal text
106106
[comtypes]
107107
description=Pure Python COM package
108108
109+
[commonmark]
110+
description=Python parser for the CommonMark Markdown spec
111+
109112
[configparser]
110113
description=This library brings the updated configparser from Python 3.5 to Python 2.6-3.5.
111114
@@ -362,6 +365,9 @@ description=A fast and thorough lazy object proxy.
362365
[libpython]
363366
description=The MinGW import library for Python
364367

368+
[lightfm]
369+
description=A Python implementation of LightFM, a hybrid recommendation algorithm.
370+
365371
[lightning-python]
366372
description=A Python client library for the Lightning data visualization server
367373

@@ -466,6 +472,9 @@ description=A system for assigning and grading notebooks.
466472
[nbpresent]
467473
description=Next generation slides from Jupyter Notebooks
468474
475+
[nbsphinx]
476+
description=Jupyter Notebook Tools for Sphinx
477+
469478
[netcdf4]
470479
description=python/numpy interface to netCDF library (versions 3 and 4)
471480
@@ -808,6 +817,9 @@ description=Provides an abstraction layer on top of the various Qt bindings (PyQ
808817
[queuelib]
809818
description=Collection of persistent (disk-based) queues
810819
820+
[recommonmark]
821+
description=A markdown parser for docutils
822+
811823
[redis]
812824
description=Python client for Redis key-value store
813825

0 commit comments

Comments
 (0)