From acfc32f5348404939d870a2676521438c7af2a36 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Wed, 5 Feb 2025 21:02:29 -0500 Subject: [PATCH] build: always use python3 in `script/lib/get-version.js` (#45444) build: always use python3 in script/lib/get-version.js Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: David Sanders --- .github/workflows/pipeline-segment-electron-test.yml | 1 + script/lib/get-version.js | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml index d4c2edeecb4a..b8b1cd981e98 100644 --- a/.github/workflows/pipeline-segment-electron-test.yml +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -74,6 +74,7 @@ jobs: echo "C:\Program Files\Git\cmd" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "C:\Python311" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + cp "C:\Python311\python.exe" "C:\Python311\python3.exe" - name: Setup Node.js/npm if: ${{ inputs.target-platform == 'win' }} uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af diff --git a/script/lib/get-version.js b/script/lib/get-version.js index 33f1ca219fb0..7179b2090754 100644 --- a/script/lib/get-version.js +++ b/script/lib/get-version.js @@ -19,10 +19,8 @@ module.exports.getElectronVersion = () => { // Error may happen when trying to get version before running gn, which is a // valid case and error will be ignored. } - // Most win32 machines have python.exe but no python3.exe. - const python = process.platform === 'win32' ? 'python.exe' : 'python3'; // Get the version from git tag if it is not defined in gn args. - const output = spawnSync(python, [path.join(ELECTRON_DIR, 'script', 'get-git-version.py')]); + const output = spawnSync('python3', [path.join(ELECTRON_DIR, 'script', 'get-git-version.py')]); if (output.status !== 0) { throw new Error(`Failed to get git tag, script quit with ${output.status}: ${output.stdout}`); }