7
7
8
8
"""
9
9
WinPython build script
10
-
11
10
Created on Sun Aug 12 11:17:50 2012
12
11
"""
13
12
22
21
from winpython import wppm , utils
23
22
import diff
24
23
25
-
26
24
CHANGELOGS_DIR = str (Path (__file__ ).parent / "changelogs" )
27
25
assert Path (CHANGELOGS_DIR ).is_dir ()
28
26
@@ -645,17 +643,14 @@ def _create_batch_scripts_initial(self):
645
643
646
644
rem force default pyqt5 kit for Spyder if PyQt5 module is there
647
645
if exist "%WINPYDIR%\Lib\site-packages\PyQt5\__init__.py" set QT_API=pyqt5
648
-
649
646
""" ,
650
647
do_changes = changes ,
651
648
)
652
649
653
650
self .create_batch_script (
654
651
"WinPython_PS_Prompt.ps1" ,
655
652
r"""
656
- ###############################
657
653
### WinPython_PS_Prompt.ps1 ###
658
- ###############################
659
654
$0 = $myInvocation.MyCommand.Definition
660
655
$dp0 = [System.IO.Path]::GetDirectoryName($0)
661
656
# $env:PYTHONUTF8 = 1 would create issues in "movable" patching
@@ -682,7 +677,6 @@ def _create_batch_scripts_initial(self):
682
677
$env:PYTHON = "%WINPYDIR%\python.exe"
683
678
$env:PYTHONPATHz = "%WINPYDIR%;%WINPYDIR%\Lib;%WINPYDIR%\DLLs"
684
679
685
-
686
680
$env:WINPYVER = '"""
687
681
+ self .winpyver
688
682
+ r"""'
@@ -701,7 +695,6 @@ def _create_batch_scripts_initial(self):
701
695
if ($env:WINPYARCH.subString($env:WINPYARCH.length-5, 5) -eq 'amd64') {
702
696
$env:WINPYARCH = 'WIN-AMD64' }
703
697
704
-
705
698
if (-not $env:PATH.ToLower().Contains(";"+ $env:WINPYDIR.ToLower()+ ";")) {
706
699
$env:PATH = """
707
700
+ '"'
@@ -714,11 +707,10 @@ def _create_batch_scripts_initial(self):
714
707
715
708
# PyQt5 qt.conf creation and winpython.ini creation done via Winpythonini.py (called per env_for_icons.bat for now)
716
709
# Start-Process -FilePath $env:PYTHON -ArgumentList ($env:WINPYDIRBASE + '\scripts\WinPythonIni.py')
717
-
718
710
}
719
- ###############################
711
+
720
712
### Set-WindowSize
721
- ###############################
713
+
722
714
Function Set-WindowSize {
723
715
Param([int]$x=$host.ui.rawui.windowsize.width,
724
716
[int]$y=$host.ui.rawui.windowsize.heigth,
@@ -735,7 +727,6 @@ def _create_batch_scripts_initial(self):
735
727
### Colorize to distinguish
736
728
$host.ui.RawUI.BackgroundColor = "Black"
737
729
$host.ui.RawUI.ForegroundColor = "White"
738
-
739
730
""" ,
740
731
do_changes = changes ,
741
732
)
@@ -805,7 +796,7 @@ def _create_batch_scripts_initial(self):
805
796
self .create_batch_script (
806
797
"WinPythonIni.py" , # Replaces winpython.vbs, and a bit of env.bat
807
798
r"""
808
- 'prepares a dynamic list of variables settings from a .ini file'
799
+ # Prepares a dynamic list of variables settings from a .ini file
809
800
import os
810
801
import subprocess
811
802
from pathlib import Path
@@ -832,8 +823,6 @@ def _create_batch_scripts_initial(self):
832
823
#JULIA=%JULIA_HOME%%JULIA_EXE%
833
824
#JULIA_PKGDIR=%WINPYDIRBASE%\settings\.julia
834
825
#QT_PLUGIN_PATH=%WINPYDIR%\Lib\site-packages\pyqt5_tools\Qt\plugins
835
-
836
-
837
826
'''
838
827
839
828
def get_file(file_name):
@@ -1111,8 +1100,6 @@ def _create_batch_scripts(self):
1111
1100
"wpcp.bat" ,
1112
1101
r"""@echo off
1113
1102
call "%~dp0env_for_icons.bat"
1114
- rem cd/D "%WINPYWORKDIR1%"
1115
- rem "%WINPYDIR%\python.exe" -m winpython.controlpanel %*
1116
1103
if not "%WINPYWORKDIR%"=="%WINPYWORKDIR1%" cd/d %WINPYWORKDIR1%
1117
1104
cmd.exe /k "echo wppm & wppm"
1118
1105
""" ,
@@ -1154,7 +1141,6 @@ def _create_batch_scripts(self):
1154
1141
) else (
1155
1142
"code.exe" %*
1156
1143
))
1157
-
1158
1144
""" ,
1159
1145
)
1160
1146
@@ -1250,12 +1236,12 @@ def make(
1250
1236
indent = True ,
1251
1237
)
1252
1238
1253
- # PyPy: get Fullversion from the executable
1239
+ # get Fullversion from the executable
1254
1240
self .python_fullversion = utils .get_python_long_version (
1255
1241
self .distribution .target
1256
1242
)
1257
1243
1258
- # PyPY: Assert that WinPython version and real python version do match
1244
+ # Assert that WinPython version and real python version do match
1259
1245
self ._print (
1260
1246
f"Python version{ self .python_fullversion .replace ('.' ,'' )} "
1261
1247
+ f"\n Distro Name { self .distribution .target } "
@@ -1268,13 +1254,10 @@ def make(
1268
1254
1269
1255
if remove_existing :
1270
1256
if not self .simulation :
1271
- # self._add_msvc_files() # replaced per msvc_runtime package
1272
1257
self ._create_batch_scripts_initial ()
1273
1258
self ._create_batch_scripts ()
1274
- # always create all launchers (as long as it is not shimmy-based, to see for after)
1275
1259
self ._create_launchers ()
1276
- # PyPY must ensure pip
1277
- # "pypy3.exe -m ensurepip"
1260
+ # PyPy must ensure pip via: "pypy3.exe -m ensurepip"
1278
1261
utils .python_execmodule ("ensurepip" , self .distribution .target )
1279
1262
1280
1263
self .distribution .patch_standard_packages ("pip" )
@@ -1287,9 +1270,7 @@ def make(
1287
1270
self ._print (f"piping { ' ' .join (actions )} " )
1288
1271
self .distribution .do_pip_action (actions )
1289
1272
self .distribution .patch_standard_packages (req )
1290
- # no more directory base package install: use requirements.txt
1291
- # 2019-05-03 removed self._install_all_other_packages()
1292
- print ("self.simulation zz" , self .simulation )
1273
+ print ("self.simulation:" , self .simulation )
1293
1274
if not self .simulation :
1294
1275
self ._copy_dev_tools ()
1295
1276
self ._copy_dev_docs ()
@@ -1313,8 +1294,7 @@ def make(
1313
1294
self ._print_done ()
1314
1295
# Writing package index
1315
1296
self ._print ("Writing package index" )
1316
- # winpyver2 = need the version without build part
1317
- # but with self.distribution.architecture
1297
+ # winpyver2 = the version without build part but with self.distribution.architecture
1318
1298
self .winpyver2 = f"{ self .python_fullversion } .{ self .build_number } "
1319
1299
fname = str (
1320
1300
Path (self .winpydir ).parent
@@ -1344,17 +1324,16 @@ def make(
1344
1324
self ._print_done ()
1345
1325
1346
1326
1347
- def rebuild_winpython (basedir , targetdir , architecture = 64 , verbose = False ):
1327
+ def rebuild_winpython (codedir , targetdir , architecture = 64 , verbose = False ):
1348
1328
"""Rebuild winpython package from source"""
1349
- basedir = basedir
1350
- packdir = targetdir
1351
- for name in os .listdir (packdir ):
1329
+
1330
+ for name in os .listdir (targetdir ):
10000
1352
1331
if name .startswith ("winpython-" ) and name .endswith ((".exe" , ".whl" , ".gz" )):
1353
- os .remove (str (Path (packdir ) / name ))
1332
+ os .remove (str (Path (targetdir ) / name ))
1354
1333
# utils.build_wininst is replaced per flit 2023-02-27
1355
1334
utils .buildflit_wininst (
1356
- str ( Path ( __file__ ). resolve (). parent ) ,
1357
- copy_to = packdir ,
1335
+ codedir ,
1336
+ copy_to = targetdir ,
1358
1337
verbose = verbose ,
1359
1338
)
1360
1339
@@ -1420,7 +1399,7 @@ def make_all(
1420
1399
1421
1400
# Rebuild Winpython in this wheel dir
1422
1401
rebuild_winpython (
1423
- basedir = basedir ,
1402
+ codedir = str ( Path ( __file__ ). resolve (). parent ), # winpython source dir
1424
1403
targetdir = wheeldir ,
1425
1404
architecture = architecture ,
1426
1405
)
@@ -1490,11 +1469,11 @@ def make_all(
1490
1469
# ,find_links=osp.join(basedir, 'packages.srcreq'))
1491
1470
if str (create_installer ).lower () != "false" and not simulation :
1492
1471
if "7zip" in str (create_installer ).lower ():
1493
- dist .create_installer_7zip (".exe" ) # 7-zip (no licence splash screen)
1472
+ dist .create_installer_7zip (".exe" )
1494
1473
if ".7z" in str (create_installer ).lower ():
1495
- dist .create_installer_7zip (".7z" ) # 7-zip (no licence splash screen)
1474
+ dist .create_installer_7zip (".7z" )
1496
1475
if ".zip" in str (create_installer ).lower ():
1497
- dist .create_installer_7zip (".zip" ) # 7-zip (no licence splash screen)
1476
+ dist .create_installer_7zip (".zip" )
1498
1477
return dist
1499
1478
1500
1479
0 commit comments