Skip to content

Commit 18eb947

Browse files
authored
Update macos-python-builder.psm1
1 parent 2d6155b commit 18eb947

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

builders/macos-python-builder.psm1

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,36 @@ class macOSPythonBuilder : NixPythonBuilder {
151151
return $pkgLocation
152152
}
153153

154+
[string] GetFrameworkName() {
155+
<#
156+
.SYNOPSIS
157+
Get the Python installation Package name.
158+
#>
159+
160+
if ($this.IsFreeThreaded()) {
161+
return "PythonT.framework"
162+
} else {
163+
return "Python.framework"
164+
}
165+
}
166+
167+
[string] GetPkgChoices() {
168+
<#
169+
.SYNOPSIS
170+
Reads the configuration XML file for the Python installer
171+
#>
172+
173+
$config = if ($this.IsFreeThreaded()) { "freethreaded" } else { "default" }
174+
$choicesFile = Join-Path $PSScriptRoot "../config/macos-pkg-choices-$($config).xml"
175+
$choicesTemplate = Get-Content -Path $choicesFile -Raw
176+
177+
$variablesToReplace = @{
178+
"{{__VERSION_MAJOR_MINOR__}}" = "$($this.Version.Major).$($this.Version.Minor)";
179+
}
180+
181+
$variablesToReplace.keys | ForEach-Object { $choicesTemplate = $choicesTemplate.Replace($_, $variablesToReplace[$_]) }
182+
return $choicesTemplate
183+
}
154184
[void] CreateInstallationScriptPkg() {
155185
<#
156186
.SYNOPSIS
@@ -165,6 +195,8 @@ class macOSPythonBuilder : NixPythonBuilder {
165195
"{{__VERSION_FULL__}}" = $this.Version;
166196
"{{__PKG_NAME__}}" = $this.GetPkgName();
167197
"{{__ARCH__}}" = $this.Architecture;
198+
"{{__FRAMEWORK_NAME__}}" = $this.GetFrameworkName();
199+
"{{__PKG_CHOICES__}}" = $this.GetPkgChoices();
168200
}
169201

170202
$variablesToReplace.keys | ForEach-Object { $installationTemplateContent = $installationTemplateContent.Replace($_, $variablesToReplace[$_]) }

0 commit comments

Comments
 (0)