Skip to content

Commit c58fa07

Browse files
committed
python: remove the pycs and pycaches
Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
1 parent d5226dc commit c58fa07

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

.github/workflows/build_test_cbsinit.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
matrix:
1111
os: ['windows-2022']
1212
download_official_python_msi: ["true", "false"]
13+
remove_python_pycs: ["true", "false"]
1314
cbsinit_repo: ['https://github.com/cloudbase/cloudbase-init']
1415
cbsinit_branch: ['master']
1516
python_version: ['3.14_4']
@@ -32,7 +33,8 @@ jobs:
3233
-CloudbaseInitRepoUrl ${{ matrix.cbsinit_repo }} ^
3334
-CloudbaseInitRepoBranch ${{ matrix.cbsinit_branch }} ^
3435
-InstallOfficialPythonMsi:$${{ matrix.download_official_python_msi }} ^
35-
-OfficialPythonMsiChecksum "C10234D0D9BD89F6F6DD55BAE28EDE0F97EE0DF4"
36+
-OfficialPythonMsiChecksum "C10234D0D9BD89F6F6DD55BAE28EDE0F97EE0DF4" ^
37+
-RemovePythonPycs:$${{ matrix.remove_python_pycs }}
3638
- uses: actions/upload-artifact@v7
3739
with:
3840
name: "CloudbaseInit_${{ matrix.platform }}_${{ matrix.os }}_MSI_${{ matrix.cbsinit_branch }}"

BuildAutomation/BuildCloudbaseInitSetup.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Param(
1212
[string]$SignTimestampUrl = "http://timestamp.digicert.com?alg=sha256",
1313
[string]$VCVars = "2019",
1414
[switch]$InstallOfficialPythonMsi = $false,
15-
[string]$OfficialPythonMsiChecksum = "C10234D0D9BD89F6F6DD55BAE28EDE0F97EE0DF4"
15+
[string]$OfficialPythonMsiChecksum = "C10234D0D9BD89F6F6DD55BAE28EDE0F97EE0DF4",
16+
[switch]$RemovePythonPycs = $false
1617
)
1718

1819
$ErrorActionPreference = "Stop"
@@ -128,6 +129,12 @@ try
128129
ExecRetry { PullInstall "cloudbase-init" $CloudbaseInitRepoUrl $CloudbaseInitRepoBranch }
129130
}
130131

132+
if ($RemovePythonPycs) {
133+
pushd $python_dir
134+
Get-ChildItem -Path .\ -Recurse -Include *__pycache__ | foreach ($_) { Remove-Item $_.FullName -Force -Recurse}
135+
Get-ChildItem -Path .\ -Recurse -Include *.pyc | foreach ($_) { Remove-Item $_.FullName -Force -Recurse}
136+
popd
137+
}
131138
$release_dir = join-path $cloudbaseInitInstallerDir "CloudbaseInitSetup\bin\Release\$platform"
132139
$bin_dir = join-path $cloudbaseInitInstallerDir "CloudbaseInitSetup\Binaries\$platform"
133140

0 commit comments

Comments
 (0)