Skip to content

Commit cb2aecd

Browse files
Add Support for Linux arm64 Builds (#274)
* Included ubuntu-arm64 in Build Python package yml * Updated builder and installer scripts * Updated test scripts * Modified test file * Replaced macos-11 with macos-13 * Update build-python-packages.yml
1 parent 1c85886 commit cb2aecd

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

.github/workflows/build-python-packages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515
PLATFORMS:
1616
description: 'Platforms for execution in "os" or "os_arch" format (arch is "x64" by default)'
1717
required: true
18-
default: 'ubuntu-20.04,ubuntu-22.04,ubuntu-24.04,macos-11_x64,macos-11_arm64,windows-2019_x64,windows-2019_x86'
18+
default: 'ubuntu-20.04,ubuntu-20.04_arm64,ubuntu-22.04,ubuntu-22.04_arm64,ubuntu-24.04,ubuntu-24.04_arm64,macos-11_x64,macos-14_arm64,windows-2019_x64,windows-2019_x86'
1919
pull_request:
2020
paths-ignore:
2121
- 'versions-manifest.json'
@@ -39,7 +39,7 @@ jobs:
3939
- name: Generate execution matrix
4040
id: generate-matrix
4141
run: |
42-
[String[]]$configurations = "${{ inputs.platforms || 'ubuntu-20.04,ubuntu-22.04,ubuntu-24.04,macos-11,macos-11_arm64,windows-2019_x64,windows-2019_x86' }}".Split(",").Trim()
42+
[String[]]$configurations = "${{ inputs.platforms || 'ubuntu-20.04,ubuntu-20.04_arm64,ubuntu-22.04,ubuntu-22.04_arm64,ubuntu-24.04,ubuntu-24.04_arm64,macos-11,macos-14_arm64,windows-2019_x64,windows-2019_x86' }}".Split(",").Trim()
4343
$matrix = @()
4444
4545
foreach ($configuration in $configurations) {

builders/nix-python-builder.psm1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class NixPythonBuilder : PythonBuilder {
9797

9898
$variablesToReplace = @{
9999
"{{__VERSION_FULL__}}" = $this.Version;
100+
"{{__ARCH__}}" = $this.Architecture;
100101
}
101102
$variablesToReplace.keys | ForEach-Object { $installationTemplateContent = $installationTemplateContent.Replace($_, $variablesToReplace[$_]) }
102103

installers/nix-setup-template.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set -e
22

33
PYTHON_FULL_VERSION="{{__VERSION_FULL__}}"
4+
ARCH="{{__ARCH__}}"
45
MAJOR_VERSION=$(echo $PYTHON_FULL_VERSION | cut -d '.' -f 1)
56
MINOR_VERSION=$(echo $PYTHON_FULL_VERSION | cut -d '.' -f 2)
67

@@ -17,7 +18,7 @@ fi
1718

1819
PYTHON_TOOLCACHE_PATH=$TOOLCACHE_ROOT/Python
1920
PYTHON_TOOLCACHE_VERSION_PATH=$PYTHON_TOOLCACHE_PATH/$PYTHON_FULL_VERSION
20-
PYTHON_TOOLCACHE_VERSION_ARCH_PATH=$PYTHON_TOOLCACHE_VERSION_PATH/x64
21+
PYTHON_TOOLCACHE_VERSION_ARCH_PATH=$PYTHON_TOOLCACHE_VERSION_PATH/$ARCH
2122

2223
echo "Check if Python hostedtoolcache folder exist..."
2324
if [ ! -d $PYTHON_TOOLCACHE_PATH ]; then
@@ -54,4 +55,4 @@ export PIP_ROOT_USER_ACTION=ignore
5455
./python -m pip install --upgrade --force-reinstall pip --disable-pip-version-check --no-warn-script-location
5556

5657
echo "Create complete file"
57-
touch $PYTHON_TOOLCACHE_VERSION_PATH/x64.complete
58+
touch $PYTHON_TOOLCACHE_VERSION_PATH/$ARCH.complete

tests/sources/python-config-test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
if pkg_installer:
2929
expected_lib_dir_path = f'/Library/Frameworks/Python.framework/Versions/{version_major}.{version_minor}/lib'
3030
else:
31-
expected_lib_dir_path = f'{os.getenv("AGENT_TOOLSDIRECTORY")}/Python/{version}/x64/lib'
31+
expected_lib_dir_path = f'{os.getenv("AGENT_TOOLSDIRECTORY")}/Python/{version}/{architecture}/lib'
3232

3333
# Check modules
3434
### Validate libraries path

0 commit comments

Comments
 (0)