@@ -332,6 +332,24 @@ $KnownPythons = @{
332
332
URL = " https://www.nuget.org/api/v2/package/pythonarm64/3.9.10" ;
333
333
SHA256 = " 429ada77e7f30e4bd8ff22953a1f35f98b2728e84c9b1d006712561785641f69" ;
334
334
};
335
+ };
336
+ " 3.10.1" = @ {
337
+ AMD64 = @ {
338
+ URL = " https://www.nuget.org/api/v2/package/python/3.10.1" ;
339
+ SHA256 = " 987a0e446d68900f58297bc47dc7a235ee4640a49dace58bc9f573797d3a8b33" ;
340
+ };
341
+ AMD64_Embedded = @ {
342
+ URL = " https://www.python.org/ftp/python/3.10.1/python-3.10.1-embed-amd64.zip" ;
343
+ SHA256 = " 502670dcdff0083847abf6a33f30be666594e7e5201cd6fccd4a523b577403de" ;
344
+ };
345
+ ARM64 = @ {
346
+ URL = " https://www.nuget.org/api/v2/package/pythonarm64/3.10.1" ;
347
+ SHA256 = " 16becfccedf1269ff0b8695a13c64fac2102a524d66cecf69a8f9229a43b10d3" ;
348
+ };
349
+ ARM64_Embedded = @ {
350
+ URL = " https://www.python.org/ftp/python/3.10.1/python-3.10.1-embed-arm64.zip" ;
351
+ SHA256 = " 1f9e215fe4e8f22a8e8fba1859efb1426437044fb3103ce85794630e3b511bc2" ;
352
+ };
335
353
}
336
354
}
337
355
@@ -351,11 +369,6 @@ $PythonModules = @{
351
369
SHA256 = " 353815f59a7f64cdaca1c0307ee13558a0512f6db064e92fe833784f08539c7a" ;
352
370
Dependencies = @ ();
353
371
};
354
- " unittest2" = @ {
355
- Version = " 1.1.0" ;
356
- SHA256 = " 22882a0e418c284e1f718a822b3b022944d53d2d908e1690b319a9d3eb2c0579" ;
357
- Dependencies = @ (" argparse" , " six" , " traceback2" , " linecache2" );
358
- };
359
372
" argparse" = @ {
360
373
Version = " 1.4.0" ;
361
374
SHA256 = " c31647edb69fd3d465a847ea3157d37bed1f95f19760b11a47aa91c04b666314" ;
@@ -602,6 +615,10 @@ function Get-PythonPath([Hashtable] $Platform) {
602
615
return [IO.Path ]::Combine(" $BinaryCache \" , " Python$ ( $Platform.Architecture.CMakeName ) -$PythonVersion " )
603
616
}
604
617
618
+ function Get-EmbeddedPythonPath ([Hashtable ] $Platform ) {
619
+ return [IO.Path ]::Combine(" $BinaryCache \" , " EmbeddedPython$ ( $Platform.Architecture.CMakeName ) -$PythonVersion " )
620
+ }
621
+
605
622
function Get-PythonExecutable {
606
623
return [IO.Path ]::Combine((Get-PythonPath $BuildPlatform ), " tools" , " python.exe" )
607
624
}
@@ -610,6 +627,10 @@ function Get-PythonScriptsPath {
610
627
return [IO.Path ]::Combine((Get-PythonPath $BuildPlatform ), " tools" , " Scripts" )
611
628
}
612
629
630
+ function Get-EmbeddedPythonInstallDir () {
631
+ return [IO.Path ]::Combine(" $ImageRoot \" , " Program Files" , " Swift" , " Python" )
632
+ }
633
+
613
634
function Get-Syft {
614
635
return $KnownSyft [$SyftVersion ][$BuildArchName ]
615
636
}
@@ -1097,11 +1118,33 @@ function Get-Dependencies {
1097
1118
return $KnownPythons [$PythonVersion ].$ArchName
1098
1119
}
1099
1120
1121
+ function Get-KnownEmbeddedPython ([string ] $ArchName ) {
1122
+ if (-not $KnownPythons.ContainsKey ($PythonVersion )) {
1123
+ throw " Unknown python version: $PythonVersion "
1124
+ }
1125
+ if (-not $KnownPythons [$PythonVersion ].ContainsKey(" ${ArchName} _Embedded" )) {
1126
+ return $null
1127
+ }
1128
+ return $KnownPythons [$PythonVersion ][" ${ArchName} _Embedded" ]
1129
+ }
1130
+
1100
1131
function Install-Python ([string ] $ArchName ) {
1101
1132
$Python = Get-KnownPython $ArchName
1102
1133
DownloadAndVerify $Python.URL " $BinaryCache \Python$ArchName -$PythonVersion .zip" $Python.SHA256
1103
1134
if (-not $ToBatch ) {
1104
- Expand-ZipFile Python$ArchName - $PythonVersion.zip " $BinaryCache " Python$ArchName - $PythonVersion
1135
+ Expand-ZipFile " Python$ArchName -$PythonVersion .zip" " $BinaryCache " " Python$ArchName -$PythonVersion "
1136
+ }
1137
+ }
1138
+
1139
+ function Install-EmbeddedPython ([string ] $ArchName ) {
1140
+ $Python = Get-KnownEmbeddedPython $ArchName
1141
+ if ($Python -eq $null ) {
1142
+ Write-Output " Python $PythonVersion does not have an embeddable version."
1143
+ return
1144
+ }
1145
+ DownloadAndVerify $Python.URL " $BinaryCache \EmbeddedPython$ArchName -$PythonVersion .zip" $Python.SHA256
1146
+ if (-not $ToBatch ) {
1147
+ Expand-ZipFile " EmbeddedPython$ArchName -$PythonVersion .zip" " $BinaryCache " " EmbeddedPython$ArchName -$PythonVersion "
1105
1148
}
1106
1149
}
1107
1150
@@ -1149,11 +1192,11 @@ function Get-Dependencies {
1149
1192
if ($Test -contains " lldb" ) {
1150
1193
Install-PythonModule " psutil" # Required for testing LLDB
1151
1194
$env: Path = " $ ( Get-PythonScriptsPath ) ;$env: Path " # For unit.exe
1152
- Install-PythonModule " unittest2" # Required for testing LLDB
1153
1195
}
1154
1196
}
1155
1197
1156
1198
Install-Python $HostArchName
1199
+ Install-EmbeddedPython $HostArchName
1157
1200
if ($IsCrossCompiling ) {
1158
1201
Install-Python $BuildArchName
1159
1202
}
@@ -3450,16 +3493,24 @@ function Install-HostToolchain() {
3450
3493
3451
3494
# Restructure _InternalSwiftScan (keep the original one for the installer)
3452
3495
Copy-Item - Force `
3453
- " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\lib\swift\_InternalSwiftScan" `
3454
- " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\include"
3496
+ - Path " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\lib\swift\_InternalSwiftScan" `
3497
+ - Destination " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\include"
3455
3498
Copy-Item - Force `
3456
- " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\lib\swift\windows\_InternalSwiftScan.lib" `
3457
- " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\lib"
3499
+ - Path " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\lib\swift\windows\_InternalSwiftScan.lib" `
3500
+ - Destination " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\lib"
3458
3501
3459
3502
# Switch to swift-driver
3460
3503
$SwiftDriver = ([IO.Path ]::Combine((Get-ProjectBinaryCache $HostPlatform Driver), " bin" , " swift-driver.exe" ))
3461
3504
Copy-Item - Force $SwiftDriver " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\bin\swift.exe"
3462
3505
Copy-Item - Force $SwiftDriver " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\bin\swiftc.exe"
3506
+
3507
+ # Copy embeddable Python
3508
+ New-Item - Type Directory - Path " $ ( Get-EmbeddedPythonInstallDir ) " - ErrorAction Ignore | Out-Null
3509
+ Write-Output " $ ( Get-EmbeddedPythonInstallDir ) "
3510
+ Copy-Item - Force `
3511
+ - Path " $ ( Get-EmbeddedPythonPath $HostPlatform ) \*" `
3512
+ - Destination " $ ( Get-EmbeddedPythonInstallDir ) " `
3513
+ - Recurse
3463
3514
}
3464
3515
3465
3516
function Build-Inspect ([Hashtable ] $Platform ) {
0 commit comments