@@ -500,12 +500,12 @@ def _create_launchers(self):
500
500
"""Create launchers"""
501
501
self ._print_action ("Creating launchers" )
502
502
# 2025-01-04: copy launchers premade per the Datalab-Python way
503
- portable_dir = Path ( __file__ ). resolve (). parent / "portable" / "launchers_final"
504
- for path in portable_dir .rglob ('*.exe' ):
505
- shutil .copy2 (path , self .winpy_dir )
506
- print ("new way !!!!!!!!!!!!!!!!!! " , path , " -> " ,self .winpy_dir )
507
- for path in ( Path ( __file__ ). resolve (). parent / "portable" ) .rglob ('licence*.*' ):
508
- shutil .copy2 (path , self .winpy_dir )
503
+ launchers_source_dir = PORTABLE_DIR / "launchers_final"
504
+ for item in launchers_source_dir .rglob ('*.exe' ):
505
+ shutil .copy2 (item , self .winpy_dir )
506
+ print ("new way !!!!!!!!!!!!!!!!!! " , item , " -> " ,self .winpy_dir )
507
+ for item in launchers_source_dir .rglob ('licence*.*' ):
508
+ shutil .copy2 (item , self .winpy_dir )
509
509
self ._print_action_done ()
510
510
511
511
@@ -567,9 +567,9 @@ def _create_initial_batch_scripts(self):
567
567
rem force default pyqt5 kit for Spyder if PyQt5 module is there
568
568
if exist "%WINPYDIR%\\ Lib\\ site-packages\\ PyQt5\\ __init__.py" set QT_API=pyqt5
569
569
"""
570
-
571
570
self .create_batch_script ("env.bat" , env_bat_content , replacements = batch_replacements )
572
571
572
+
573
573
ps1_content = r"""### WinPython_PS_Prompt.ps1 ###
574
574
$0 = $myInvocation.MyCommand.Definition
575
575
$dp0 = [System.IO.Path]::GetDirectoryName($0)
@@ -615,11 +615,10 @@ def _create_initial_batch_scripts(self):
615
615
Param([int]$x=$host.ui.rawui.windowsize.width,
616
616
[int]$y=$host.ui.rawui.windowsize.heigth,
617
617
[int]$buffer=$host.UI.RawUI.BufferSize.heigth)
618
-
619
618
$buffersize = new-object System.Management.Automation.Host.Size($x,$buffer)
620
619
$host.UI.RawUI.BufferSize = $buffersize
621
620
$size = New-Object System.Management.Automation.Host.Size($x,$y)
622
- $host.ui.rawui.WindowSize = $size
621
+ $host.ui.rawui.WindowSize = $size
623
622
}
624
623
# Windows10 yelling at us with 150 40 6000
625
624
# Set-WindowSize 195 40 6000
@@ -629,16 +628,15 @@ def _create_initial_batch_scripts(self):
629
628
$host.ui.RawUI.ForegroundColor = "White"
630
629
}
631
630
"""
632
-
633
631
self .create_batch_script ("WinPython_PS_Prompt.ps1" , ps1_content , replacements = batch_replacements )
634
632
635
-
636
633
cmd_ps_bat_content = r"""@echo off
637
634
call "%~dp0env_for_icons.bat"
638
635
Powershell.exe -Command "& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy RemoteSigned -noexit -File ""%~dp0WinPython_PS_Prompt.ps1""'}"
639
636
"""
640
637
self .create_batch_script ("cmd_ps.bat" , cmd_ps_bat_content , replacements = batch_replacements )
641
638
639
+
642
640
env_for_icons_bat_content = r"""@echo off
643
641
call "%~dp0env.bat"
644
642
@@ -675,15 +673,12 @@ def _create_initial_batch_scripts(self):
675
673
if not "%WINPYWORKDIR%"=="" if not exist "%WINPYWORKDIR%" mkdir "%WINPYWORKDIR%"
676
674
if not "%WINPYWORKDIR1%"=="" if not exist "%WINPYWORKDIR1%" mkdir "%WINPYWORKDIR1%"
677
675
678
-
679
676
rem Change of directory only if we are in a launcher directory
680
677
if "%__CD__%scripts\"=="%~dp0" cd/D %WINPYWORKDIR1%
681
678
if "%__CD__%"=="%~dp0" cd/D %WINPYWORKDIR1%
682
679
683
-
684
680
if not exist "%HOME%\.spyder-py%WINPYVER:~0,1%" mkdir "%HOME%\.spyder-py%WINPYVER:~0,1%"
685
681
if not exist "%HOME%\.spyder-py%WINPYVER:~0,1%\workingdir" echo %HOME%\Notebooks>"%HOME%\.spyder-py%WINPYVER:~0,1%\workingdir"
686
-
687
682
"""
688
683
self .create_batch_script ("env_for_icons.bat" , env_for_icons_bat_content , replacements = batch_replacements )
689
684
@@ -745,12 +740,12 @@ def main():
745
740
import sys
746
741
args = sys.argv[1:]
747
742
file_name = args[0] if args else "..\\settings\\winpython.ini"
748
-
743
+
749
744
my_lines = get_file(file_name).splitlines()
750
745
segment = "environment"
751
746
txt = ""
752
747
env = os.environ.copy() # later_version: env = os.environ
753
-
748
+
754
749
# default directories (from .bat)
755
750
os.makedirs(Path(env['WINPYDIRBASE']) / 'settings' / 'Appdata' / 'Roaming', exist_ok=True)
756
751
@@ -779,7 +774,7 @@ def main():
779
774
env[data[0].strip()] = translate(data[1].strip(), env)
780
775
if segment == "debug" and data[0].strip() == "state":
781
776
txt += f"set WINPYDEBUG={data[1].strip()}&&"
782
-
777
+
783
778
print(txt)
784
779
785
780
# set potential directory
@@ -812,7 +807,6 @@ def _create_standard_batch_scripts(self):
812
807
813
808
814
809
self .create_batch_script ("readme.txt" , """These batch files are required to run WinPython icons.
815
-
816
810
These files should help the user writing his/her own
817
811
specific batch file to call Python scripts inside WinPython.
818
812
The environment variables are set-up in 'env_.bat' and 'env_for_icons.bat'.""" ,
@@ -991,6 +985,7 @@ def _run_complementary_batch_scripts(self, script_name="run_complement.bat"):
991
985
self ._print_action (f"Execution failed: { e } !" )
992
986
self ._print_action_done ()
993
987
988
+
994
989
def make (
995
990
self ,
996
991
remove_existing = True ,
@@ -1024,16 +1019,12 @@ def make(
1024
1019
self ._extract_python_archive ()
1025
1020
1026
1021
self ._print_action_done ()
1027
-
1028
1022
self .distribution = wppm .Distribution (
1029
1023
self .python_executable_dir ,
1030
1024
verbose = self .verbose ,
1031
1025
indent = True ,
1032
1026
)
1033
1027
1034
-
1035
-
1036
-
1037
1028
# Assert that WinPython version and real python version do match
1038
1029
self ._print_action (
1039
1030
f"Python version{ self .python_full_version .replace ('.' ,'' )} "
@@ -1050,8 +1041,8 @@ def make(
1050
1041
self ._create_standard_batch_scripts ()
1051
1042
self ._create_launchers ()
1052
1043
utils .python_execmodule ("ensurepip" , self .distribution .target ) # Ensure pip is installed for PyPy
1053
-
1054
1044
self .distribution .patch_standard_packages ("pip" )
1045
+
1055
1046
# Upgrade essential packages
1056
1047
essential_packages = ["pip" , "setuptools" , "wheel" , "winpython" ]
1057
1048
for package_name in essential_packages :
@@ -1074,6 +1065,7 @@ def make(
1074
1065
print (f"piping { ' ' .join (actions )} " )
1075
1066
self ._print_action (f"piping { ' ' .join (actions )} " )
1076
1067
self .distribution .do_pip_action (actions )
1068
+
1077
1069
self ._run_complementary_batch_scripts ()
1078
1070
self .distribution .patch_standard_packages ()
1079
1071
@@ -1094,6 +1086,7 @@ def make(
1094
1086
)
1095
1087
open (fname , "w" , encoding = 'utf-8' ).write (self .package_index_markdown )
1096
1088
# Copy to winpython/changelogs
1089
+
1097
1090
shutil .copyfile (
1098
1091
fname ,
1099
1092
str (Path (CHANGELOGS_DIR ) / Path (fname ).name ),
@@ -1272,4 +1265,4 @@ def make_all(
1272
1265
source_dirs = r"D:\WinPython\basedir34\packages.win-amd64" ,
1273
1266
toolsdirs = r"D:\WinPython\basedir34\t.Slim" ,
1274
1267
docsdirs = r"D:\WinPython\basedir34\docs.Slim" ,
1275
- )
1268
+ )
0 commit comments