Skip to content

Commit 9473902

Browse files
committed
ensure python executable is not equivalent before symlink
1 parent 1671dba commit 9473902

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ on:
4242
pull_request:
4343
push:
4444
tags:
45-
- '**[0-9]+.[0-9]+.[0-9]+*'
45+
- "**[0-9]+.[0-9]+.[0-9]+*"
4646

4747
jobs:
4848
# Run 'dist plan' (or host) to determine what tasks we need to do
@@ -63,15 +63,22 @@ jobs:
6363
- name: Setup Python 3.12
6464
uses: actions/setup-python@v5
6565
with:
66-
python-version: '3.12'
66+
python-version: "3.12"
6767
- name: Ensure python3.12 alias (unix)
6868
if: runner.os != 'Windows'
6969
shell: bash
70-
run: ln -sf "$pythonLocation/bin/python" "$pythonLocation/bin/python3.12"
70+
# Check that files are not equivalent before linking.
71+
run: |
72+
if ! ["$pythonLocation/bin/python" -ef "$pythonLocation/bin/python3.12"]; then
73+
ln -sf "$pythonLocation/bin/python" "$pythonLocation/bin/python3.12"
74+
fi
7175
- name: Ensure python3.12 alias (windows)
7276
if: runner.os == 'Windows'
7377
shell: pwsh
74-
run: Copy-Item "$env:pythonLocation\\python.exe" "$env:pythonLocation\\python3.12.exe" -Force
78+
run: |
79+
if (!(Test-Path "$env:pythonLocation\\python3.12.exe") -or ((Get-Item "$env:pythonLocation\\python.exe").FullName -ne (Get-Item "$env:pythonLocation\\python3.12.exe").FullName)) {
80+
Copy-Item "$env:pythonLocation\\python.exe" "$env:pythonLocation\\python3.12.exe" -Force
81+
}
7582
- name: Install dist
7683
# we specify bash to get pipefail; it guards against the `curl` command
7784
# failing. otherwise `sh` won't catch that `curl` returned non-0
@@ -194,7 +201,7 @@ jobs:
194201
- name: Setup Python 3.12
195202
uses: actions/setup-python@v5
196203
with:
197-
python-version: '3.12'
204+
python-version: "3.12"
198205
- name: Ensure python3.12 alias (unix)
199206
shell: bash
200207
run: ln -sf "$pythonLocation/bin/python" "$pythonLocation/bin/python3.12"

0 commit comments

Comments
 (0)