8000 update-install path --user flag for x86 for >=3.10 · actions/setup-python@bd89e34 · GitHub
[go: up one dir, main page]

Skip to content

Commit bd89e34

Browse files
update-install path --user flag for x86 for >=3.10
1 parent 6ca8e85 commit bd89e34

File tree

2 files changed

+37
-9
lines changed

2 files changed

+37
-9
lines changed

dist/setup/index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99611,8 +99611,18 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
9961199611
const version = path.basename(path.dirname(installDir));
9961299612
const major = semver.major(version);
9961399613
const minor = semver.minor(version);
99614-
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
99615-
core.addPath(userScriptsDir);
99614+
if (architecture === 'x86' &&
99615+
(major > 3 || (major === 3 && minor >= 10))) {
99616+
// For Python >= 3.10 and architecture= 'x86', add the architecture-specific folder to the path
99617+
const arch = '32';
99618+
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}-${arch}`, 'Scripts');
99619+
core.addPath(userScriptsDir);
99620+
}
99621+
else {
99622+
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
99623+
// Add the default path to the environment PATH variable
99624+
core.addPath(userScriptsDir);
99625+
}
9961699626
}
9961799627
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
9961899628
}

src/find-python.ts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,31 @@ export async function useCpythonVersion(
141141
const major = semver.major(version);
142142
const minor = semver.minor(version);
143143

144-
const userScriptsDir = path.join(
145-
process.env['APPDATA'] || '',
146-
'Python',
147-
`Python${major}${minor}`,
148-
'Scripts'
E743 149-
);
150-
core.addPath(userScriptsDir);
144+
if (
145+
architecture === 'x86' &&
146+
(major > 3 || (major === 3 && minor >= 10))
147+
) {
148+
// For Python >= 3.10 and architecture= 'x86', add the architecture-specific folder to the path
149+
const arch = '32';
150+
151+
const userScriptsDir = path.join(
152+
process.env['APPDATA'] || '',
153+
'Python',
154+
`Python${major}${minor}-${arch}`,
155+
'Scripts'
156+
);
157+
core.addPath(userScriptsDir);
158+
} else {
159+
const userScriptsDir = path.join(
160+
process.env['APPDATA'] || '',
161+
'Python',
162+
`Python${major}${minor}`,
163+
'Scripts'
164+
);
165+
166+
// Add the default path to the environment PATH variable
167+
core.addPath(userScriptsDir);
168+
}
151169
}
152170
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
153171
}

0 commit comments

Comments
 (0)
0