From 1fc813fd6ab04402b9dc97f46530a88e15295e32 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Wed, 6 May 2026 15:46:54 +0300 Subject: [PATCH 01/19] python: add pymanager Python download option Signed-off-by: Adrian Vladu --- .github/workflows/build_test_cbsinit.yml | 6 ++- BuildAutomation/BuildCloudbaseInitSetup.ps1 | 17 +++++--- BuildAutomation/BuildUtils.ps1 | 48 +++++++++++++++++++++ 3 files changed, 64 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_test_cbsinit.yml b/.github/workflows/build_test_cbsinit.yml index 2cfa3ddd..88258c05 100644 --- a/.github/workflows/build_test_cbsinit.yml +++ b/.github/workflows/build_test_cbsinit.yml @@ -11,6 +11,7 @@ jobs: os: ['windows-2022'] download_official_python_msi: ["true"] remove_python_pycs: ["true"] + install_with_pymanager: ["true"] cbsinit_repo: ['https://github.com/cloudbase/cloudbase-init'] cbsinit_branch: ['master'] python_version: ['3.14_4'] @@ -34,10 +35,11 @@ jobs: -CloudbaseInitRepoBranch ${{ matrix.cbsinit_branch }} ^ -InstallOfficialPythonMsi:$${{ matrix.download_official_python_msi }} ^ -OfficialPythonMsiChecksum "C10234D0D9BD89F6F6DD55BAE28EDE0F97EE0DF4" ^ - -RemovePythonPycs:$${{ matrix.remove_python_pycs }} + -RemovePythonPycs:$${{ matrix.remove_python_pycs }} ^ + -InstallOfficialPythonUsingPyManager:$${{ matrix.install_with_pymanager }} - uses: actions/upload-artifact@v7 with: - name: "CloudbaseInit_platform-${{ matrix.platform }}_build-env-os-${{ matrix.os }}_download-official-msi-${{ matrix.download_official_python_msi }}_remove-pycs-${{ matrix.remove_python_pycs }}_cbs-init-branch-${{ matrix.cbsinit_branch }}_MSI" + name: "CloudbaseInit_platform-${{ matrix.platform }}_build-env-os-${{ matrix.os }}_download-official-msi-${{ matrix.download_official_python_msi }}_remove-pycs-${{ matrix.remove_python_pycs }}_install-with-pymanager${{ matrix.install_with_pymanager }}_cbs-init-branch-${{ matrix.cbsinit_branch }}_MSI" path: 'CloudbaseInitSetup/bin/release/${{ matrix.platform }}/CloudbaseInitSetup.msi' - name: Download external dependencies shell: powershell diff --git a/BuildAutomation/BuildCloudbaseInitSetup.ps1 b/BuildAutomation/BuildCloudbaseInitSetup.ps1 index 1ad9a7c1..a69d9a34 100644 --- a/BuildAutomation/BuildCloudbaseInitSetup.ps1 +++ b/BuildAutomation/BuildCloudbaseInitSetup.ps1 @@ -13,7 +13,8 @@ Param( [string]$VCVars = "2019", [switch]$InstallOfficialPythonMsi = $false, [string]$OfficialPythonMsiChecksum = "C10234D0D9BD89F6F6DD55BAE28EDE0F97EE0DF4", - [switch]$RemovePythonPycs = $false + [switch]$RemovePythonPycs = $false, + [switch]$InstallOfficialPythonUsingPyManager = $false ) $ErrorActionPreference = "Stop" @@ -80,12 +81,18 @@ try $python_template_dir = join-path $cloudbaseInitInstallerDir "Python$($pythonversion.replace('.', ''))_${platform}_Template" + # TODO(avladu): stick to just only one way to download Python, preferably the pymanager once it gets ironed out if ($InstallOfficialPythonMsi) { - if (!$OfficialPythonMsiChecksum) { - throw "Please set a OfficialPythonMsiChecksum parameter value." + if ($InstallOfficialPythonUsingPyManager) { + Remove-Item -Recurse -Force $python_template_dir -ErrorAction SilentlyContinue + DownloadInstall-PythonUsingPyManager $platform $python_template_dir $pythonversion + } else { + if (!$OfficialPythonMsiChecksum) { + throw "Please set a OfficialPythonMsiChecksum parameter value." + } + Remove-Item -Recurse -Force $python_template_dir -ErrorAction SilentlyContinue + DownloadInstall-PythonMsi $platform $python_template_dir $pythonversion $OfficialPythonMsiChecksum } - Remove-Item -Recurse -Force $python_template_dir -ErrorAction SilentlyContinue - DownloadInstall-PythonMsi $platform $python_template_dir $pythonversion $OfficialPythonMsiChecksum } CheckCopyDir $python_template_dir $python_dir diff --git a/BuildAutomation/BuildUtils.ps1 b/BuildAutomation/BuildUtils.ps1 index 604f52e2..a9c3f13e 100644 --- a/BuildAutomation/BuildUtils.ps1 +++ b/BuildAutomation/BuildUtils.ps1 @@ -460,3 +460,51 @@ function DownloadInstall-PythonMsi($platform, $python_template_dir, $pythonVersi } } + +function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $pythonVersion) { + $pythonManagerUrl = "https://www.python.org/ftp/python/pymanager/python-manager-26.1.msix" + $pythonManagerPath = Join-Path (Resolve-Path "${python_template_dir}/..").Path "/python-manager.exe" + + $pythonManagerPackage = Get-AppPackage -Name PythonSoftwareFoundation.PythonManager -ErrorAction SilentlyContinue + + if (!$pythonManagerPackage) { + ExecRetry { DownloadFile $pythonManagerUrl $pythonManagerPath } + Add-AppPackage -Path $pythonManagerPath + } + + $platformSuffix = "" + if ($platform -eq "x86") { + $platformSuffix = "-32" + } + if ($platform -eq "arm64") { + $platformSuffix = "-arm64" + } + + if (Test-Path $python_template_dir) { + throw "$python_template_dir folder already exists" + } + + $pythonVersionEscaped = $pythonVersion.replace("_",".") + $platformSuffix + pymanager.exe install --target=$python_template_dir --force --update $pythonVersionEscaped + if ($LASTEXITCODE) { + throw "Failed to install python in directory: ${python_template_dir}" + } + + if (!(Test-Path $python_template_dir)) { + throw "$python_template_dir has not been created" + } + + & "$python_template_dir/python.exe" --version + if ($LASTEXITCODE) { + throw "Failed to run python in directory: ${python_template_dir}" + } + + Remove-Item -Force -Recurse "$python_template_dir/DLLs/_tkinter.pyd" + Remove-Item -Force -Recurse "$python_template_dir/DLLs/tcl*.dll" + Remove-Item -Force -Recurse "$python_template_dir/DLLs/tk*.dll" + Remove-Item -Force -Recurse "$python_template_dir/Doc" + Remove-Item -Force -Recurse "$python_template_dir/Lib/tkinter" + Remove-Item -Force -Recurse "$python_template_dir/Lib/turtle.py" + Remove-Item -Force -Recurse "$python_template_dir/Lib/turtledemo" + Remove-Item -Force -Recurse "$python_template_dir/tcl" +} \ No newline at end of file From 13f10e32325b25766ad710ed5816eacf10b639aa Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 12:35:54 +0300 Subject: [PATCH 02/19] python: use pymanager embeded Signed-off-by: Adrian Vladu --- BuildAutomation/BuildUtils.ps1 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/BuildAutomation/BuildUtils.ps1 b/BuildAutomation/BuildUtils.ps1 index a9c3f13e..d0e87e21 100644 --- a/BuildAutomation/BuildUtils.ps1 +++ b/BuildAutomation/BuildUtils.ps1 @@ -484,7 +484,7 @@ function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $ throw "$python_template_dir folder already exists" } - $pythonVersionEscaped = $pythonVersion.replace("_",".") + $platformSuffix + $pythonVersionEscaped = "PythonEmbed\" + $pythonVersion.replace("_",".") + $platformSuffix pymanager.exe install --target=$python_template_dir --force --update $pythonVersionEscaped if ($LASTEXITCODE) { throw "Failed to install python in directory: ${python_template_dir}" @@ -499,12 +499,12 @@ function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $ throw "Failed to run python in directory: ${python_template_dir}" } - Remove-Item -Force -Recurse "$python_template_dir/DLLs/_tkinter.pyd" - Remove-Item -Force -Recurse "$python_template_dir/DLLs/tcl*.dll" - Remove-Item -Force -Recurse "$python_template_dir/DLLs/tk*.dll" - Remove-Item -Force -Recurse "$python_template_dir/Doc" - Remove-Item -Force -Recurse "$python_template_dir/Lib/tkinter" - Remove-Item -Force -Recurse "$python_template_dir/Lib/turtle.py" - Remove-Item -Force -Recurse "$python_template_dir/Lib/turtledemo" - Remove-Item -Force -Recurse "$python_template_dir/tcl" -} \ No newline at end of file + Remove-Item -Force -Recurse "$python_template_dir/DLLs/_tkinter.pyd" -ErrorAction SilentlyContinue + Remove-Item -Force -Recurse "$python_template_dir/DLLs/tcl*.dll" -ErrorAction SilentlyContinue + Remove-Item -Force -Recurse "$python_template_dir/DLLs/tk*.dll" -ErrorAction SilentlyContinue + Remove-Item -Force -Recurse "$python_template_dir/Doc" -ErrorAction SilentlyContinue + Remove-Item -Force -Recurse "$python_template_dir/Lib/tkinter" -ErrorAction SilentlyContinue + Remove-Item -Force -Recurse "$python_template_dir/Lib/turtle.py" -ErrorAction SilentlyContinue + Remove-Item -Force -Recurse "$python_template_dir/Lib/turtledemo" -ErrorAction SilentlyContinue + Remove-Item -Force -Recurse "$python_template_dir/tcl" -ErrorAction SilentlyContinue +} From 293d889270ef2cacbfbd6c167d118263a0f22345 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 12:45:06 +0300 Subject: [PATCH 03/19] python: ensure pip is installed --- BuildAutomation/BuildUtils.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/BuildAutomation/BuildUtils.ps1 b/BuildAutomation/BuildUtils.ps1 index d0e87e21..43c0dc8c 100644 --- a/BuildAutomation/BuildUtils.ps1 +++ b/BuildAutomation/BuildUtils.ps1 @@ -499,6 +499,15 @@ function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $ throw "Failed to run python in directory: ${python_template_dir}" } + $pythonGetPipUrl = "https://bootstrap.pypa.io/get-pip.py" + $pythonGetPipPath = Join-Path (Resolve-Path "${python_template_dir}/..").Path "/get-pip.py" + ExecRetry { DownloadFile $pythonGetPipUrl $pythonGetPipPath } + + & "$python_template_dir/python.exe" "${pythonGetPipPath}" + if ($LASTEXITCODE) { + throw "Failed to install pip in directory: ${python_template_dir}" + } + Remove-Item -Force -Recurse "$python_template_dir/DLLs/_tkinter.pyd" -ErrorAction SilentlyContinue Remove-Item -Force -Recurse "$python_template_dir/DLLs/tcl*.dll" -ErrorAction SilentlyContinue Remove-Item -Force -Recurse "$python_template_dir/DLLs/tk*.dll" -ErrorAction SilentlyContinue From 56b77ee03ace4beb3a3bb46aee7a1429d0fb3c77 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 12:48:06 +0300 Subject: [PATCH 04/19] python: ensure pip is installed in the correct dir --- BuildAutomation/BuildCloudbaseInitSetup.ps1 | 9 +++++++++ BuildAutomation/BuildUtils.ps1 | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/BuildAutomation/BuildCloudbaseInitSetup.ps1 b/BuildAutomation/BuildCloudbaseInitSetup.ps1 index a69d9a34..eb938bf6 100644 --- a/BuildAutomation/BuildCloudbaseInitSetup.ps1 +++ b/BuildAutomation/BuildCloudbaseInitSetup.ps1 @@ -97,6 +97,15 @@ try CheckCopyDir $python_template_dir $python_dir + $pythonGetPipUrl = "https://bootstrap.pypa.io/get-pip.py" + $pythonGetPipPath = Join-Path (Resolve-Path "${python_dir}/..").Path "/get-pip.py" + ExecRetry { DownloadFile $pythonGetPipUrl $pythonGetPipPath } + + & python.exe "${pythonGetPipPath}" + if ($LASTEXITCODE) { + throw "Failed to install pip in directory: ${python_dir}" + } + # Make sure that we don't have temp files from a previous build $python_build_path = "$ENV:LOCALAPPDATA\Temp\pip_build_$ENV:USERNAME" if (Test-Path $python_build_path) { diff --git a/BuildAutomation/BuildUtils.ps1 b/BuildAutomation/BuildUtils.ps1 index 43c0dc8c..d0e87e21 100644 --- a/BuildAutomation/BuildUtils.ps1 +++ b/BuildAutomation/BuildUtils.ps1 @@ -499,15 +499,6 @@ function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $ throw "Failed to run python in directory: ${python_template_dir}" } - $pythonGetPipUrl = "https://bootstrap.pypa.io/get-pip.py" - $pythonGetPipPath = Join-Path (Resolve-Path "${python_template_dir}/..").Path "/get-pip.py" - ExecRetry { DownloadFile $pythonGetPipUrl $pythonGetPipPath } - - & "$python_template_dir/python.exe" "${pythonGetPipPath}" - if ($LASTEXITCODE) { - throw "Failed to install pip in directory: ${python_template_dir}" - } - Remove-Item -Force -Recurse "$python_template_dir/DLLs/_tkinter.pyd" -ErrorAction SilentlyContinue Remove-Item -Force -Recurse "$python_template_dir/DLLs/tcl*.dll" -ErrorAction SilentlyContinue Remove-Item -Force -Recurse "$python_template_dir/DLLs/tk*.dll" -ErrorAction SilentlyContinue From 8ce958a454eb74b94933a05e4d894694b4199f6a Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 12:51:45 +0300 Subject: [PATCH 05/19] python: ensure pip is installed in the correct dir --- BuildAutomation/BuildCloudbaseInitSetup.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BuildAutomation/BuildCloudbaseInitSetup.ps1 b/BuildAutomation/BuildCloudbaseInitSetup.ps1 index eb938bf6..aabbfa74 100644 --- a/BuildAutomation/BuildCloudbaseInitSetup.ps1 +++ b/BuildAutomation/BuildCloudbaseInitSetup.ps1 @@ -106,6 +106,8 @@ try throw "Failed to install pip in directory: ${python_dir}" } + python.exe -m pip install pip --upgrade + # Make sure that we don't have temp files from a previous build $python_build_path = "$ENV:LOCALAPPDATA\Temp\pip_build_$ENV:USERNAME" if (Test-Path $python_build_path) { From ba03ae413cc251273cf885e582761c8b4278fef4 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 12:53:57 +0300 Subject: [PATCH 06/19] python: ensure pip is installed in the correct dir --- BuildAutomation/BuildCloudbaseInitSetup.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BuildAutomation/BuildCloudbaseInitSetup.ps1 b/BuildAutomation/BuildCloudbaseInitSetup.ps1 index aabbfa74..ca1ef051 100644 --- a/BuildAutomation/BuildCloudbaseInitSetup.ps1 +++ b/BuildAutomation/BuildCloudbaseInitSetup.ps1 @@ -107,6 +107,8 @@ try } python.exe -m pip install pip --upgrade + python.exe -m pip install wheel --upgrade + python.exe -m pip install setuptools --upgrade # Make sure that we don't have temp files from a previous build $python_build_path = "$ENV:LOCALAPPDATA\Temp\pip_build_$ENV:USERNAME" From 1f0a37c3fe780ce4258bb6e9cd0a8d74b93ef3f4 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 12:58:03 +0300 Subject: [PATCH 07/19] python: ensure pip is installed in the correct dir --- BuildAutomation/BuildCloudbaseInitSetup.ps1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/BuildAutomation/BuildCloudbaseInitSetup.ps1 b/BuildAutomation/BuildCloudbaseInitSetup.ps1 index ca1ef051..7abb0b6e 100644 --- a/BuildAutomation/BuildCloudbaseInitSetup.ps1 +++ b/BuildAutomation/BuildCloudbaseInitSetup.ps1 @@ -106,10 +106,8 @@ try throw "Failed to install pip in directory: ${python_dir}" } - python.exe -m pip install pip --upgrade - python.exe -m pip install wheel --upgrade - python.exe -m pip install setuptools --upgrade - + Out-File -Append -InputObject "Lib\site-packages" -Encoding ascii $python_dir\python*._pth + # Make sure that we don't have temp files from a previous build $python_build_path = "$ENV:LOCALAPPDATA\Temp\pip_build_$ENV:USERNAME" if (Test-Path $python_build_path) { From 56590ae4e0eb94fc4cb406668bb6ecae2a7725ee Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 14:57:32 +0300 Subject: [PATCH 08/19] python: ensure pbr is installed --- BuildAutomation/BuildCloudbaseInitSetup.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/BuildAutomation/BuildCloudbaseInitSetup.ps1 b/BuildAutomation/BuildCloudbaseInitSetup.ps1 index 7abb0b6e..e60d9a48 100644 --- a/BuildAutomation/BuildCloudbaseInitSetup.ps1 +++ b/BuildAutomation/BuildCloudbaseInitSetup.ps1 @@ -115,6 +115,11 @@ try } ExecRetry { PipInstall "pip" -update $true } + # When using embed Python, pbr needs to be reinstalled so that the project builds + # Warning received: UserWarning: Unknown distribution option: 'pbr' + # pbr is already installed but most likely this is a problem with knowing where it is, + # and reinstalling fixing the issue + ExecRetry { PipInstall "pbr" -update $true } ExecRetry { PipInstall "wheel" -update $true } ExecRetry { PipInstall "setuptools" -update $true } From ad3fed779b730e4f7476c80800c465c88d8fbf36 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 15:13:02 +0300 Subject: [PATCH 09/19] python: ensure Include folder is there --- BuildAutomation/BuildUtils.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BuildAutomation/BuildUtils.ps1 b/BuildAutomation/BuildUtils.ps1 index d0e87e21..0541f13d 100644 --- a/BuildAutomation/BuildUtils.ps1 +++ b/BuildAutomation/BuildUtils.ps1 @@ -499,6 +499,16 @@ function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $ throw "Failed to run python in directory: ${python_template_dir}" } + $gitTag = $pythonVersion.replace("_",".") + git clone --no-checkout --depth=1 --filter=tree:0 https://github.com/python/cpython --branch "v${gitTag}" + pushd cpython + git sparse-checkout set --no-cone /Include + git checkout + popd + + Move-Item "cpython/Include" "$python_template_dir/Include" + Remove-Item -Force -Recurse "cpython" + Remove-Item -Force -Recurse "$python_template_dir/DLLs/_tkinter.pyd" -ErrorAction SilentlyContinue Remove-Item -Force -Recurse "$python_template_dir/DLLs/tcl*.dll" -ErrorAction SilentlyContinue Remove-Item -Force -Recurse "$python_template_dir/DLLs/tk*.dll" -ErrorAction SilentlyContinue From 1befc0cd2a1fbe408f702e0752d5ca7006fa8648 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 15:27:09 +0300 Subject: [PATCH 10/19] python: ensure Include folder is there --- BuildAutomation/BuildCloudbaseInitSetup.ps1 | 2 -- BuildAutomation/BuildUtils.ps1 | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/BuildAutomation/BuildCloudbaseInitSetup.ps1 b/BuildAutomation/BuildCloudbaseInitSetup.ps1 index e60d9a48..870cb795 100644 --- a/BuildAutomation/BuildCloudbaseInitSetup.ps1 +++ b/BuildAutomation/BuildCloudbaseInitSetup.ps1 @@ -105,8 +105,6 @@ try if ($LASTEXITCODE) { throw "Failed to install pip in directory: ${python_dir}" } - - Out-File -Append -InputObject "Lib\site-packages" -Encoding ascii $python_dir\python*._pth # Make sure that we don't have temp files from a previous build $python_build_path = "$ENV:LOCALAPPDATA\Temp\pip_build_$ENV:USERNAME" diff --git a/BuildAutomation/BuildUtils.ps1 b/BuildAutomation/BuildUtils.ps1 index 0541f13d..7bad7ca0 100644 --- a/BuildAutomation/BuildUtils.ps1 +++ b/BuildAutomation/BuildUtils.ps1 @@ -499,6 +499,9 @@ function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $ throw "Failed to run python in directory: ${python_template_dir}" } + Out-File -Append -InputObject "Lib\site-packages" -Encoding ascii $python_template_dir\python*._pth + + # fix Cannot open include file: 'pyconfig.h' $gitTag = $pythonVersion.replace("_",".") git clone --no-checkout --depth=1 --filter=tree:0 https://github.com/python/cpython --branch "v${gitTag}" pushd cpython @@ -506,7 +509,8 @@ function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $ git checkout popd - Move-Item "cpython/Include" "$python_template_dir/Include" + Move-Item "cpython/Include" "$python_template_dir/include" + Get-ChildItem "$python_template_dir/include" Remove-Item -Force -Recurse "cpython" Remove-Item -Force -Recurse "$python_template_dir/DLLs/_tkinter.pyd" -ErrorAction SilentlyContinue From 6efdf9dd401d4fd5a966f3aad72c2d0abbbd717c Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 15:31:53 +0300 Subject: [PATCH 11/19] python: ensure Include folder is there --- BuildAutomation/BuildUtils.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BuildAutomation/BuildUtils.ps1 b/BuildAutomation/BuildUtils.ps1 index 7bad7ca0..d7203ea9 100644 --- a/BuildAutomation/BuildUtils.ps1 +++ b/BuildAutomation/BuildUtils.ps1 @@ -510,6 +510,8 @@ function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $ popd Move-Item "cpython/Include" "$python_template_dir/include" + ExecRetry { DownloadFile "https://raw.githubusercontent.com/python/cpython/refs/tags/v${gitTag}/PC/pyconfig.h" "${python_template_dir}/include/pyconfig.h" } + Get-ChildItem "$python_template_dir/include" Remove-Item -Force -Recurse "cpython" From de90ea4d0ed4a85a79b762b764cfdf1d098e471f Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 15:35:02 +0300 Subject: [PATCH 12/19] python: ensure lib folder is used --- BuildAutomation/BuildUtils.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/BuildAutomation/BuildUtils.ps1 b/BuildAutomation/BuildUtils.ps1 index d7203ea9..f87ec5a5 100644 --- a/BuildAutomation/BuildUtils.ps1 +++ b/BuildAutomation/BuildUtils.ps1 @@ -500,6 +500,7 @@ function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $ } Out-File -Append -InputObject "Lib\site-packages" -Encoding ascii $python_template_dir\python*._pth + Out-File -Append -InputObject "libs" -Encoding ascii $python_template_dir\python*._pth # fix Cannot open include file: 'pyconfig.h' $gitTag = $pythonVersion.replace("_",".") From 1a3fc7a1989e5cc659ad94513258ca1c91e4d657 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 15:43:18 +0300 Subject: [PATCH 13/19] python: use 3.11.9 as there are no wheels for pymi for 3.14 --- .github/workflows/build_test_cbsinit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_test_cbsinit.yml b/.github/workflows/build_test_cbsinit.yml index 88258c05..1fcdcacb 100644 --- a/.github/workflows/build_test_cbsinit.yml +++ b/.github/workflows/build_test_cbsinit.yml @@ -14,7 +14,7 @@ jobs: install_with_pymanager: ["true"] cbsinit_repo: ['https://github.com/cloudbase/cloudbase-init'] cbsinit_branch: ['master'] - python_version: ['3.14_4'] + python_version: ['3.11_9'] platform: ['x64'] cloud: [openstack] From 8e3b4f2233df3b787738ef3b8887dc9d664c8d96 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 15:47:18 +0300 Subject: [PATCH 14/19] python: over arching hack to make embeded work by borrowing include/libs folders from the full install --- .github/workflows/build_test_cbsinit.yml | 2 +- BuildAutomation/BuildUtils.ps1 | 24 +++++++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build_test_cbsinit.yml b/.github/workflows/build_test_cbsinit.yml index 1fcdcacb..88258c05 100644 --- a/.github/workflows/build_test_cbsinit.yml +++ b/.github/workflows/build_test_cbsinit.yml @@ -14,7 +14,7 @@ jobs: install_with_pymanager: ["true"] cbsinit_repo: ['https://github.com/cloudbase/cloudbase-init'] cbsinit_branch: ['master'] - python_version: ['3.11_9'] + python_version: ['3.14_4'] platform: ['x64'] cloud: [openstack] diff --git a/BuildAutomation/BuildUtils.ps1 b/BuildAutomation/BuildUtils.ps1 index f87ec5a5..bdfef3e2 100644 --- a/BuildAutomation/BuildUtils.ps1 +++ b/BuildAutomation/BuildUtils.ps1 @@ -502,19 +502,17 @@ function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $ Out-File -Append -InputObject "Lib\site-packages" -Encoding ascii $python_template_dir\python*._pth Out-File -Append -InputObject "libs" -Encoding ascii $python_template_dir\python*._pth - # fix Cannot open include file: 'pyconfig.h' - $gitTag = $pythonVersion.replace("_",".") - git clone --no-checkout --depth=1 --filter=tree:0 https://github.com/python/cpython --branch "v${gitTag}" - pushd cpython - git sparse-checkout set --no-cone /Include - git checkout - popd - - Move-Item "cpython/Include" "$python_template_dir/include" - ExecRetry { DownloadFile "https://raw.githubusercontent.com/python/cpython/refs/tags/v${gitTag}/PC/pyconfig.h" "${python_template_dir}/include/pyconfig.h" } - - Get-ChildItem "$python_template_dir/include" - Remove-Item -Force -Recurse "cpython" + $python_template_dir_full = $python_template_dir + "_full" + $pythonVersionEscaped = $pythonVersion.replace("_",".") + $platformSuffix + pymanager.exe install --target=$python_template_dir_full --force --update $pythonVersionEscaped + if ($LASTEXITCODE) { + throw "Failed to install python in directory: ${python_template_dir_full}" + } + + Move-Item $python_template_dir_full/include python_template_dir/ + Move-Item $python_template_dir_full/libs python_template_dir/ + + Remove-Item -Force -Recurse "$python_template_dir_full" -ErrorAction SilentlyContinue Remove-Item -Force -Recurse "$python_template_dir/DLLs/_tkinter.pyd" -ErrorAction SilentlyContinue Remove-Item -Force -Recurse "$python_template_dir/DLLs/tcl*.dll" -ErrorAction SilentlyContinue From 20b3e65465cb01dca8f7c527b8e5796d6b1fa9e4 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 15:50:13 +0300 Subject: [PATCH 15/19] python: over arching hack to make embeded work by borrowing include/libs folders from the full install --- BuildAutomation/BuildUtils.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BuildAutomation/BuildUtils.ps1 b/BuildAutomation/BuildUtils.ps1 index bdfef3e2..9b64674b 100644 --- a/BuildAutomation/BuildUtils.ps1 +++ b/BuildAutomation/BuildUtils.ps1 @@ -509,8 +509,8 @@ function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $ throw "Failed to install python in directory: ${python_template_dir_full}" } - Move-Item $python_template_dir_full/include python_template_dir/ - Move-Item $python_template_dir_full/libs python_template_dir/ + Move-Item $python_template_dir_full/include $python_template_dir/ + Move-Item $python_template_dir_full/libs $python_template_dir/ Remove-Item -Force -Recurse "$python_template_dir_full" -ErrorAction SilentlyContinue From d116359342b04b8ce60ef93f677aec1fd3e752cc Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 16:06:50 +0300 Subject: [PATCH 16/19] python: over arching hack to make embeded work by borrowing include/libs folders from the full install --- BuildAutomation/BuildUtils.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/BuildAutomation/BuildUtils.ps1 b/BuildAutomation/BuildUtils.ps1 index 9b64674b..033910cd 100644 --- a/BuildAutomation/BuildUtils.ps1 +++ b/BuildAutomation/BuildUtils.ps1 @@ -512,6 +512,13 @@ function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $ Move-Item $python_template_dir_full/include $python_template_dir/ Move-Item $python_template_dir_full/libs $python_template_dir/ + mkdir $python_template_dir\Lib\site-packages + + Out-File -Append -InputObject "win32" -Encoding ascii "$python_template_dir\Lib\site-packages\pywin32.pth" + Out-File -Append -InputObject "win32\lib" -Encoding ascii "$python_template_dir\Lib\site-packages\pywin32.pth" + Out-File -Append -InputObject "Pythonwin" -Encoding ascii "$python_template_dir\Lib\site-packages\pywin32.pth" + Out-File -Append -InputObject "import pywin32_bootstrap" -Encoding ascii "$python_template_dir\Lib\site-packages\pywin32.pth" + Remove-Item -Force -Recurse "$python_template_dir_full" -ErrorAction SilentlyContinue Remove-Item -Force -Recurse "$python_template_dir/DLLs/_tkinter.pyd" -ErrorAction SilentlyContinue From cb32607d5e3b6ca67e9b49b3b36411d860712efd Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 16:25:27 +0300 Subject: [PATCH 17/19] python: keep pycs --- .github/workflows/build_test_cbsinit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_test_cbsinit.yml b/.github/workflows/build_test_cbsinit.yml index 88258c05..dd529ccd 100644 --- a/.github/workflows/build_test_cbsinit.yml +++ b/.github/workflows/build_test_cbsinit.yml @@ -10,7 +10,7 @@ jobs: matrix: os: ['windows-2022'] download_official_python_msi: ["true"] - remove_python_pycs: ["true"] + remove_python_pycs: ["false"] install_with_pymanager: ["true"] cbsinit_repo: ['https://github.com/cloudbase/cloudbase-init'] cbsinit_branch: ['master'] From 0d4eebacd52f6bc8b6f29eb09b4f7d9d905b64bd Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 16:48:30 +0300 Subject: [PATCH 18/19] python: over arching hack to make embeded work by borrowing include/libs folders from the full install --- BuildAutomation/BuildUtils.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BuildAutomation/BuildUtils.ps1 b/BuildAutomation/BuildUtils.ps1 index 033910cd..405b3ec2 100644 --- a/BuildAutomation/BuildUtils.ps1 +++ b/BuildAutomation/BuildUtils.ps1 @@ -519,6 +519,10 @@ function DownloadInstall-PythonUsingPyManager($platform, $python_template_dir, $ Out-File -Append -InputObject "Pythonwin" -Encoding ascii "$python_template_dir\Lib\site-packages\pywin32.pth" Out-File -Append -InputObject "import pywin32_bootstrap" -Encoding ascii "$python_template_dir\Lib\site-packages\pywin32.pth" + Out-File -Append -InputObject "Lib\site-packages\win32" -Encoding ascii $python_template_dir\python*._pth + Out-File -Append -InputObject "Lib\site-packages\win32\lib" -Encoding ascii $python_template_dir\python*._pth + Out-File -Append -InputObject "Lib\site-packages\Pythonwin" -Encoding ascii $python_template_dir\python*._pth + Remove-Item -Force -Recurse "$python_template_dir_full" -ErrorAction SilentlyContinue Remove-Item -Force -Recurse "$python_template_dir/DLLs/_tkinter.pyd" -ErrorAction SilentlyContinue From 9f1af440508f0830ffb158056d445ebe1ec7a4f8 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 7 May 2026 16:56:03 +0300 Subject: [PATCH 19/19] python: add venv --- .github/workflows/build_test_cbsinit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_test_cbsinit.yml b/.github/workflows/build_test_cbsinit.yml index dd529ccd..89c63561 100644 --- a/.github/workflows/build_test_cbsinit.yml +++ b/.github/workflows/build_test_cbsinit.yml @@ -101,6 +101,7 @@ jobs: } } & $pythonPath -m pip install pip-audit + & $pythonPath -m pip install venv $pipAuditLogs = & $pipAuditPath Write-Output "$pipAuditLogs" if ($LASTEXITCODE) {