Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build_test_cbsinit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
}
}
& $pythonPath -m pip install pip-audit
$pipAuditLogs = & $pipAuditPath
$pipAuditLogs = & $pipAuditPath --user
Write-Output "$pipAuditLogs"
if ($LASTEXITCODE) {
throw "pip audit failed"
Expand Down
14 changes: 14 additions & 0 deletions BuildAutomation/BuildCloudbaseInitSetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,27 @@ 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) {
Remove-Item -Recurse -Force $python_build_path
}

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 }

Expand Down
46 changes: 36 additions & 10 deletions BuildAutomation/BuildUtils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -499,12 +499,38 @@ 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"
}
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

$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/

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"

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
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
}
Loading