mirror of
https://github.com/actions/setup-python.git
synced 2025-06-28 05:33:47 +00:00
updated the script
This commit is contained in:
parent
a49e508555
commit
ec0fcb0341
2 changed files with 25 additions and 17 deletions
9
.github/workflows/e2e-tests.yml
vendored
9
.github/workflows/e2e-tests.yml
vendored
|
@ -136,9 +136,10 @@ jobs:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
architecture: ${{ matrix.architecture }}
|
architecture: ${{ matrix.architecture }}
|
||||||
freethreaded: ${{ matrix.freethreaded }}
|
freethreaded: ${{ matrix.freethreaded }}
|
||||||
|
|
||||||
- name: Verify Install Path
|
- name: Verify Install Path
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: python __tests__/verify-windows-install-path.py ``
|
run: |
|
||||||
-arch ${{ matrix.architecture }} `
|
python __tests__/verify-windows-install-path.py `
|
||||||
-freethreaded ${{ matrix.freethreaded }} `
|
${{ matrix.python-version }} `
|
||||||
|
${{ matrix.architecture }} `
|
||||||
|
${{ matrix.freethreaded }}
|
||||||
|
|
|
@ -1,35 +1,42 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
def build_expected_path(architecture, freethreaded):
|
def build_expected_path(python_version, architecture, freethreaded):
|
||||||
major = 3
|
# Extract major and minor from full version like "3.13.1" or "3.14.0-beta.2"
|
||||||
minor = 13
|
match = re.match(r"^(\d+)\.(\d+)", python_version)
|
||||||
|
if not match:
|
||||||
|
print(f"Invalid python version format: {python_version}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
major, minor = match.groups()
|
||||||
version_suffix = f"{major}{minor}"
|
version_suffix = f"{major}{minor}"
|
||||||
|
|
||||||
if architecture == "x86" and (major > 3 or (major == 3 and minor >= 10)):
|
|
||||||
version_suffix += "-32"
|
|
||||||
elif architecture == "arm64":
|
|
||||||
version_suffix += "-arm64"
|
|
||||||
|
|
||||||
if freethreaded == "true":
|
if freethreaded == "true":
|
||||||
version_suffix += "t"
|
version_suffix += "t"
|
||||||
if architecture == "x86":
|
if architecture == "x86":
|
||||||
version_suffix += "-32"
|
version_suffix += "-32"
|
||||||
elif architecture == "arm64":
|
elif architecture == "arm64":
|
||||||
version_suffix += "-arm64"
|
version_suffix += "-arm64"
|
||||||
|
else:
|
||||||
|
if architecture == "x86":
|
||||||
|
version_suffix += "-32"
|
||||||
|
elif architecture == "arm64":
|
||||||
|
version_suffix += "-arm64"
|
||||||
|
|
||||||
base_path = os.getenv("APPDATA", "")
|
base_path = os.getenv("APPDATA", "")
|
||||||
return os.path.join(base_path, "Python", f"Python{version_suffix}", "Scripts")
|
return os.path.join(base_path, "Python", f"Python{version_suffix}", "Scripts")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) != 3:
|
if len(sys.argv) != 4:
|
||||||
print("Usage: python verify_windows_install_path.py <architecture> <freethreaded>")
|
print("Usage: python verify_windows_install_path.py <python_version> <architecture> <freethreaded>")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
architecture = sys.argv[1]
|
python_version = sys.argv[1]
|
||||||
freethreaded = sys.argv[2]
|
architecture = sys.argv[2]
|
||||||
|
freethreaded = sys.argv[3]
|
||||||
|
|
||||||
expected_path = build_expected_path(architecture, freethreaded)
|
expected_path = build_expected_path(python_version, architecture, freethreaded)
|
||||||
print(f"Expected PATH entry: {expected_path}")
|
print(f"Expected PATH entry: {expected_path}")
|
||||||
|
|
||||||
path_env = os.getenv("PATH", "")
|
path_env = os.getenv("PATH", "")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue