Support building free-threaded CPython (#319)

* Support building free-threaded CPython

Add support for Python's free threading build mode where the global
interpreter lock is disabled. The packages are marked using a suffix on
the architecture, like 'x64-freethreaded' or 'arm64-freethreaded'.

* Match '-freethreaded' in arch

* Use type 'string' instead of 'str'

* On Linux, only delete Python installations with the same architecture.

This matches the macOS behavior and allows users to install both the
free-threading and default builds at the same time.
This commit is contained in:
Sam Gross
2025-02-20 09:42:21 -05:00
committed by GitHub
parent e550a75036
commit d456108e6b
14 changed files with 176 additions and 39 deletions

View File

@ -7,6 +7,8 @@ param (
$Architecture
)
$HardwareArchitecture = $Architecture -replace "-freethreaded", ""
Import-Module (Join-Path $PSScriptRoot "../helpers/pester-extensions.psm1")
Import-Module (Join-Path $PSScriptRoot "../helpers/common-helpers.psm1")
Import-Module (Join-Path $PSScriptRoot "../builders/python-version.psm1")
@ -58,7 +60,7 @@ Describe "Tests" {
# }
# }
if (($Version -ge "3.2.0") -and ($Version -lt "3.11.0") -and (($Platform -ne "darwin") -or ($Architecture -ne "arm64"))) {
if (($Version -ge "3.2.0") -and ($Version -lt "3.11.0") -and (($Platform -ne "darwin") -or ($HardwareArchitecture -ne "arm64"))) {
It "Check if sqlite3 module is installed" {
"python ./sources/python-sqlite3.py" | Should -ReturnZeroExitCode
}