mirror of
https://code.forgejo.org/actions/setup-python
synced 2025-06-08 20:38:19 +02:00
format update
This commit is contained in:
parent
7469b5436f
commit
2e54943954
3 changed files with 45 additions and 6 deletions
43
__tests__/verify_windows_install_path_user.py
Normal file
43
__tests__/verify_windows_install_path_user.py
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def build_expected_path(architecture, freethreaded):
|
||||||
|
major = 3
|
||||||
|
minor = 13
|
||||||
|
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":
|
||||||
|
version_suffix += "t"
|
||||||
|
if architecture == "x86":
|
||||||
|
version_suffix += "-32"
|
||||||
|
elif architecture == "arm64":
|
||||||
|
version_suffix += "-arm64"
|
||||||
|
|
||||||
|
base_path = os.getenv("APPDATA", "")
|
||||||
|
return os.path.join(base_path, "Python", f"Python{version_suffix}", "Scripts")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) != 3:
|
||||||
|
print("Usage: python verify_windows_install_path.py <architecture> <freethreaded>")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
architecture = sys.argv[1]
|
||||||
|
freethreaded = sys.argv[2]
|
||||||
|
|
||||||
|
expected_path = build_expected_path(architecture, freethreaded)
|
||||||
|
print(f"Expected PATH entry: {expected_path}")
|
||||||
|
|
||||||
|
path_env = os.getenv("PATH", "")
|
||||||
|
if expected_path.lower() not in path_env.lower():
|
||||||
|
print("Expected path not found in PATH")
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
print("Correct path present in PATH")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
3
dist/setup/index.js
vendored
3
dist/setup/index.js
vendored
|
@ -96171,8 +96171,7 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
|
||||||
const basePath = process.env['APPDATA'] || '';
|
const basePath = process.env['APPDATA'] || '';
|
||||||
let versionSuffix = `${major}${minor}`;
|
let versionSuffix = `${major}${minor}`;
|
||||||
// Append '-32' for x86 architecture if Python version is >= 3.10
|
// Append '-32' for x86 architecture if Python version is >= 3.10
|
||||||
if (architecture === 'x86' &&
|
if (architecture === 'x86' && (major > 3 || (major === 3 && minor >= 10))) {
|
||||||
(major > 3 || (major === 3 && minor >= 10))) {
|
|
||||||
versionSuffix += '-32';
|
versionSuffix += '-32';
|
||||||
}
|
}
|
||||||
else if (architecture === 'arm64') {
|
else if (architecture === 'arm64') {
|
||||||
|
|
|
@ -160,10 +160,7 @@ export async function useCpythonVersion(
|
||||||
const basePath = process.env['APPDATA'] || '';
|
const basePath = process.env['APPDATA'] || '';
|
||||||
let versionSuffix = `${major}${minor}`;
|
let versionSuffix = `${major}${minor}`;
|
||||||
// Append '-32' for x86 architecture if Python version is >= 3.10
|
// Append '-32' for x86 architecture if Python version is >= 3.10
|
||||||
if (
|
if (architecture === 'x86' && (major > 3 || (major === 3 && minor >= 10))){
|
||||||
architecture === 'x86' &&
|
|
||||||
(major > 3 || (major === 3 && minor >= 10))
|
|
||||||
) {
|
|
||||||
versionSuffix += '-32';
|
versionSuffix += '-32';
|
||||||
} else if (architecture === 'arm64') {
|
} else if (architecture === 'arm64') {
|
||||||
versionSuffix += '-arm64';
|
versionSuffix += '-arm64';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue