@@ -338,26 +338,46 @@ $KnownPythons = @{
338338 }
339339}
340340
341- $PythonWheels = @ {
341+ $PythonModules = @ {
342342 " packaging" = @ {
343- File = " packaging- 24.1-py3-none-any.whl " ;
344- URL = " https://files.pythonhosted.org/packages/08/aa/cc0199a5f0ad350994d660967a8efb233fe0416e4639146c089643407ce6/packaging-24.1-py3-none-any.whl " ;
345- SHA256 = " 5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124 " ;
343+ Version = " 24.1" ;
344+ SHA256 = " 026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 " ;
345+ Dependencies = @ () ;
346346 };
347- " distutils " = @ {
348- File = " setuptools- 75.1.0-py3-none-any.whl " ;
349- URL = " https://files.pythonhosted.org/packages/ff/ae/f19306b5a221f6a436d8f2238d5b80925004093fa3edea59835b514d9057/setuptools-75.1.0-py3-none-any.whl " ;
350- SHA256 = " 35ab7fd3bcd95e6b7fd704e4a1539513edad446c097797f2985e0e4b960772f2 " ;
347+ " setuptools " = @ {
348+ Version = " 75.1.0" ;
349+ SHA256 = " d59a21b17a275fb872a9c3dae73963160ae079f1049ed956880cd7c09b120538 " ;
350+ Dependencies = @ () ;
351351 };
352352 " psutil" = @ {
353- File = " psutil- 6.1.0-cp37-abi3-win_amd64.whl " ;
354- URL = " https://files.pythonhosted.org/packages/11/91/87fa6f060e649b1e1a7b19a4f5869709fbf750b7c8c262ee776ec32f3028/psutil-6.1.0-cp37-abi3-win_amd64.whl " ;
355- SHA256 = " a8fb3752b491d246034fa4d279ff076501588ce8cbcdbb62c32fd7a377d996be " ;
353+ Version = " 6.1.0" ;
354+ SHA256 = " 353815f59a7f64cdaca1c0307ee13558a0512f6db064e92fe833784f08539c7a " ;
355+ Dependencies = @ () ;
356356 };
357357 " unittest2" = @ {
358- File = " unittest2-1.1.0-py2.py3-none-any.whl" ;
359- URL = " https://files.pythonhosted.org/packages/72/20/7f0f433060a962200b7272b8c12ba90ef5b903e218174301d0abfd523813/unittest2-1.1.0-py2.py3-none-any.whl" ;
360- SHA256 = " 13f77d0875db6d9b435e1d4f41e74ad4cc2eb6e1d5c824996092b3430f088bb8" ;
358+ Version = " 1.1.0" ;
359+ SHA256 = " 22882a0e418c284e1f718a822b3b022944d53d2d908e1690b319a9d3eb2c0579" ;
360+ Dependencies = @ (" argparse" , " six" , " traceback2" , " linecache2" );
361+ };
362+ " argparse" = @ {
363+ Version = " 1.4.0" ;
364+ SHA256 = " c31647edb69fd3d465a847ea3157d37bed1f95f19760b11a47aa91c04b666314" ;
365+ Dependencies = @ ();
366+ };
367+ " six" = @ {
368+ Version = " 1.17.0" ;
369+ SHA256 = " 4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274" ;
370+ Dependencies = @ ();
371+ };
372+ " traceback2" = @ {
373+ Version = " 1.4.0" ;
374+ SHA256 = " 8253cebec4b19094d67cc5ed5af99bf1dba1285292226e98a31929f87a5d6b23" ;
375+ Dependencies = @ ();
376+ };
377+ " linecache2" = @ {
378+ Version = " 1.0.0" ;
379+ SHA256 = " e78be9c0a0dfcbac712fe04fbf92b96cddae80b1b842f24248214c8496f006ef" ;
380+ Dependencies = @ ();
361381 };
362382}
363383
@@ -1007,27 +1027,40 @@ function Get-Dependencies {
10071027 }
10081028 }
10091029
1010- function Install-PythonWheel ([string ] $ModuleName ) {
1030+ function Test-PythonModuleInstalled ([string ] $ModuleName ) {
10111031 try {
10121032 Invoke-Program - Silent " $ ( Get-PythonExecutable ) " - c " import $ModuleName "
1033+ return $true ;
10131034 } catch {
1014- $Wheel = $PythonWheels [$ModuleName ]
1015- DownloadAndVerify $Wheel.URL " $BinaryCache \python\$ ( $Wheel.File ) " $Wheel.SHA256
1016- Write-Output " Installing '$ ( $Wheel.File ) ' ..."
1017- Invoke-Program - OutNull " $ ( Get-PythonExecutable ) " ' -I' - m pip install " $BinaryCache \python\$ ( $Wheel.File ) " -- disable-pip - version- check
1018- } finally {
1019- Write-Output " $ModuleName installed."
1035+ return $false ;
1036+ }
1037+ }
1038+
1039+ function Install-PythonModule ([string ] $ModuleName ) {
1040+ if (Test-PythonModuleInstalled $ModuleName ) {
1041+ Write-Output " $ModuleName already installed."
1042+ return ;
1043+ }
1044+ $TempRequirementsTxt = New-TemporaryFile
1045+ $Module = $PythonModules [$ModuleName ]
1046+ $Dependencies = $Module [" Dependencies" ]
1047+ Write-Output " $ModuleName ==$ ( $Module.Version ) --hash=`" sha256:$ ( $Module.SHA256 ) `" " >> $TempRequirementsTxt
1048+ for ($i = 0 ; $i -lt $Dependencies.Length ; $i ++ ) {
1049+ $Dependency = $PythonModules [$Dependencies [$i ]]
1050+ Write-Output " $ ( $Dependencies [$i ]) ==$ ( $Dependency.Version ) --hash=`" sha256:$ ( $Dependency.SHA256 ) `" " >> $TempRequirementsTxt
10201051 }
1052+ Invoke-Program - OutNull " $ ( Get-PythonExecutable ) " ' -I' - m pip install - r $TempRequirementsTxt -- require- hashes -- no- binary== :all: -- disable-pip - version- check
1053+ Write-Output " $ModuleName installed."
10211054 }
10221055
10231056 function Install-PythonModules () {
10241057 Install-PIPIfNeeded
1025- Install-PythonWheel " packaging" # For building LLVM 18+
1026- Install-PythonWheel " distutils " # Required for SWIG support
1058+ Install-PythonModule " packaging" # For building LLVM 18+
1059+ Install-PythonModule " setuptools " # Required for SWIG support
10271060 if ($Test -contains " lldb" ) {
1028- Install-PythonWheel " psutil" # Required for testing LLDB
1061+ Install-PythonModule " psutil" # Required for testing LLDB
10291062 $env: Path = " $ ( Get-PythonScriptsPath ) ;$env: Path " # For unit.exe
1030- Install-PythonWheel " unittest2" # Required for testing LLDB
1063+ Install-PythonModule " unittest2" # Required for testing LLDB
10311064 }
10321065 }
10331066
0 commit comments