@@ -330,6 +330,24 @@ $KnownPythons = @{
330
330
URL = " https://www.nuget.org/api/v2/package/pythonarm64/3.9.10" ;
331
331
SHA256 = " 429ada77e7f30e4bd8ff22953a1f35f98b2728e84c9b1d006712561785641f69" ;
332
332
};
333
+ };
334
+ " 3.10.1" = @ {
335
+ AMD64 = @ {
336
+ URL = " https://www.nuget.org/api/v2/package/python/3.10.1" ;
337
+ SHA256 = " 987a0e446d68900f58297bc47dc7a235ee4640a49dace58bc9f573797d3a8b33" ;
338
+ };
339
+ AMD64_Embedded = @ {
340
+ URL = " https://www.python.org/ftp/python/3.10.1/python-3.10.1-embed-amd64.zip" ;
341
+ SHA256 = " 502670dcdff0083847abf6a33f30be666594e7e5201cd6fccd4a523b577403de" ;
342
+ };
343
+ ARM64 = @ {
344
+ URL = " https://www.nuget.org/api/v2/package/pythonarm64/3.10.1" ;
345
+ SHA256 = " 16becfccedf1269ff0b8695a13c64fac2102a524d66cecf69a8f9229a43b10d3" ;
346
+ };
347
+ ARM64_Embedded = @ {
348
+ URL = " https://www.python.org/ftp/python/3.10.1/python-3.10.1-embed-arm64.zip" ;
349
+ SHA256 = " 1f9e215fe4e8f22a8e8fba1859efb1426437044fb3103ce85794630e3b511bc2" ;
350
+ };
333
351
}
334
352
}
335
353
@@ -349,11 +367,6 @@ $PythonModules = @{
349
367
SHA256 = " 353815f59a7f64cdaca1c0307ee13558a0512f6db064e92fe833784f08539c7a" ;
350
368
Dependencies = @ ();
351
369
};
352
- " unittest2" = @ {
353
- Version = " 1.1.0" ;
354
- SHA256 = " 22882a0e418c284e1f718a822b3b022944d53d2d908e1690b319a9d3eb2c0579" ;
355
- Dependencies = @ (" argparse" , " six" , " traceback2" , " linecache2" );
356
- };
357
370
" argparse" = @ {
358
371
Version = " 1.4.0" ;
359
372
SHA256 = " c31647edb69fd3d465a847ea3157d37bed1f95f19760b11a47aa91c04b666314" ;
@@ -590,6 +603,10 @@ function Get-PythonPath([Hashtable] $Platform) {
590
603
return [IO.Path ]::Combine(" $BinaryCache \" , " Python$ ( $Platform.Architecture.CMakeName ) -$PythonVersion " )
591
604
}
592
605
606
+ function Get-EmbeddedPythonPath ([Hashtable ] $Platform ) {
607
+ return [IO.Path ]::Combine(" $BinaryCache \" , " EmbeddedPython$ ( $Platform.Architecture.CMakeName ) -$PythonVersion " )
608
+ }
609
+
593
610
function Get-PythonExecutable {
594
611
return [IO.Path ]::Combine((Get-PythonPath $BuildPlatform ), " tools" , " python.exe" )
595
612
}
@@ -598,6 +615,10 @@ function Get-PythonScriptsPath {
598
615
return [IO.Path ]::Combine((Get-PythonPath $BuildPlatform ), " tools" , " Scripts" )
599
616
}
600
617
618
+ function Get-EmbeddedPythonInstallDir () {
619
+ return [IO.Path ]::Combine(" $ImageRoot \" , " Program Files" , " Swift" , " Python" )
620
+ }
621
+
601
622
function Get-InstallDir ([Hashtable ] $Platform ) {
602
623
if ($Platform -eq $HostPlatform ) {
603
624
return [IO.Path ]::Combine(" $ImageRoot \" , " Program Files" , " Swift" )
@@ -1067,11 +1088,33 @@ function Get-Dependencies {
1067
1088
return $KnownPythons [$PythonVersion ].$ArchName
1068
1089
}
1069
1090
1091
+ function Get-KnownEmbeddedPython ([string ] $ArchName ) {
1092
+ if (-not $KnownPythons.ContainsKey ($PythonVersion )) {
1093
+ throw " Unknown python version: $PythonVersion "
1094
+ }
1095
+ if (-not $KnownPythons [$PythonVersion ].ContainsKey(" ${ArchName} _Embedded" )) {
1096
+ return $null
1097
+ }
1098
+ return $KnownPythons [$PythonVersion ][" ${ArchName} _Embedded" ]
1099
+ }
1100
+
1070
1101
function Install-Python ([string ] $ArchName ) {
1071
1102
$Python = Get-KnownPython $ArchName
1072
1103
DownloadAndVerify $Python.URL " $BinaryCache \Python$ArchName -$PythonVersion .zip" $Python.SHA256
1073
1104
if (-not $ToBatch ) {
1074
- Expand-ZipFile Python$ArchName - $PythonVersion.zip " $BinaryCache " Python$ArchName - $PythonVersion
1105
+ Expand-ZipFile " Python$ArchName -$PythonVersion .zip" " $BinaryCache " " Python$ArchName -$PythonVersion "
1106
+ }
1107
+ }
1108
+
1109
+ function Install-EmbeddedPython ([string ] $ArchName ) {
1110
+ $Python = Get-KnownEmbeddedPython $ArchName
1111
+ if ($Python -eq $null ) {
1112
+ Write-Output " Python $PythonVersion does not have an embeddable version."
1113
+ return
1114
+ }
1115
+ DownloadAndVerify $Python.URL " $BinaryCache \EmbeddedPython$ArchName -$PythonVersion .zip" $Python.SHA256
1116
+ if (-not $ToBatch ) {
1117
+ Expand-ZipFile " EmbeddedPython$ArchName -$PythonVersion .zip" " $BinaryCache " " EmbeddedPython$ArchName -$PythonVersion "
1075
1118
}
1076
1119
}
1077
1120
@@ -1119,11 +1162,11 @@ function Get-Dependencies {
1119
1162
if ($Test -contains " lldb" ) {
1120
1163
Install-PythonModule " psutil" # Required for testing LLDB
1121
1164
$env: Path = " $ ( Get-PythonScriptsPath ) ;$env: Path " # For unit.exe
1122
- Install-PythonModule " unittest2" # Required for testing LLDB
1123
1165
}
1124
1166
}
1125
1167
1126
1168
Install-Python $HostArchName
1169
+ Install-EmbeddedPython $HostArchName
1127
1170
if ($IsCrossCompiling ) {
1128
1171
Install-Python $BuildArchName
1129
1172
}
@@ -3442,16 +3485,24 @@ function Install-HostToolchain() {
3442
3485
3443
3486
# Restructure _InternalSwiftScan (keep the original one for the installer)
3444
3487
Copy-Item - Force `
3445
- " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\lib\swift\_InternalSwiftScan" `
3446
- " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\include"
3488
+ - Path " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\lib\swift\_InternalSwiftScan" `
3489
+ - Destination " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\include"
3447
3490
Copy-Item - Force `
3448
- " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\lib\swift\windows\_InternalSwiftScan.lib" `
3449
- " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\lib"
3491
+ - Path " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\lib\swift\windows\_InternalSwiftScan.lib" `
3492
+ - Destination " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\lib"
3450
3493
3451
3494
# Switch to swift-driver
3452
3495
$SwiftDriver = ([IO.Path ]::Combine((Get-ProjectBinaryCache $HostPlatform Driver), " bin" , " swift-driver.exe" ))
3453
3496
Copy-Item - Force $SwiftDriver " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\bin\swift.exe"
3454
3497
Copy-Item - Force $SwiftDriver " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\bin\swiftc.exe"
3498
+
3499
+ # Copy embeddable Python
3500
+ New-Item - Type Directory - Path " $ ( Get-EmbeddedPythonInstallDir ) " - ErrorAction Ignore | Out-Null
3501
+ Write-Output " $ ( Get-EmbeddedPythonInstallDir ) "
3502
+ Copy-Item - Force `
3503
+ - Path " $ ( Get-EmbeddedPythonPath $HostPlatform ) \*" `
3504
+ - Destination " $ ( Get-EmbeddedPythonInstallDir ) " `
3505
+ - Recurse
3455
3506
}
3456
3507
3457
3508
function Build-Inspect ([Hashtable ] $Platform ) {
0 commit comments