Skip to content

Commit

Permalink
Update macos-python-builder.psm1
Browse files Browse the repository at this point in the history
  • Loading branch information
gowridurgad authored Jan 23, 2025
1 parent 2d6155b commit 18eb947
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions builders/macos-python-builder.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,36 @@ class macOSPythonBuilder : NixPythonBuilder {
return $pkgLocation
}

[string] GetFrameworkName() {
<#
.SYNOPSIS
Get the Python installation Package name.
#>

if ($this.IsFreeThreaded()) {
return "PythonT.framework"
} else {
return "Python.framework"
}
}

[string] GetPkgChoices() {
<#
.SYNOPSIS
Reads the configuration XML file for the Python installer
#>

$config = if ($this.IsFreeThreaded()) { "freethreaded" } else { "default" }
$choicesFile = Join-Path $PSScriptRoot "../config/macos-pkg-choices-$($config).xml"
$choicesTemplate = Get-Content -Path $choicesFile -Raw

$variablesToReplace = @{
"{{__VERSION_MAJOR_MINOR__}}" = "$($this.Version.Major).$($this.Version.Minor)";
}

$variablesToReplace.keys | ForEach-Object { $choicesTemplate = $choicesTemplate.Replace($_, $variablesToReplace[$_]) }
return $choicesTemplate
}
[void] CreateInstallationScriptPkg() {
<#
.SYNOPSIS
Expand All @@ -165,6 +195,8 @@ class macOSPythonBuilder : NixPythonBuilder {
"{{__VERSION_FULL__}}" = $this.Version;
"{{__PKG_NAME__}}" = $this.GetPkgName();
"{{__ARCH__}}" = $this.Architecture;
"{{__FRAMEWORK_NAME__}}" = $this.GetFrameworkName();
"{{__PKG_CHOICES__}}" = $this.GetPkgChoices();
}

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

0 comments on commit 18eb947

Please sign in to comment.