8000 update-install-path-freethreaded · actions/setup-python@feb0ff9 · GitHub
[go: up one dir, main page]

Skip to content

Commit feb0ff9

Browse files
update-install-path-freethreaded
1 parent bd89e34 commit feb0ff9

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

dist/setup/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99606,23 +99606,24 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
9960699606
core.addPath(_binDir);
9960799607
if (utils_1.IS_WINDOWS) {
9960899608
// Add --user directory
99609-
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
99610-
// So if `findLocalTool` succeeded above, we must have a conformant `installDir`
9961199609
const version = path.basename(path.dirname(installDir));
9961299610
const major = semver.major(version);
9961399611
const minor = semver.minor(version);
9961499612
if (architecture === 'x86' &&
9961599613
(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';
99614+
// For Python >= 3.10 and architecture='x86', add the architecture-specific folder to the path
99615+
const arch = '32'; // Only for x86 architecture
9961899616
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}-${arch}`, 'Scripts');
9961999617
core.addPath(userScriptsDir);
9962099618
}
9962199619
else {
99620+
// For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
9962299621
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
99623-
// Add the default path to the environment PATH variable
9962499622
core.addPath(userScriptsDir);
9962599623
}
99624+
// Dynamically handle case for Python314t
99625+
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}t`, 'Scripts');
99626+
core.addPath(pythonPath);
9962699627
}
9962799628
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
9962899629
}

src/find-python.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ export async function useCpythonVersion(
135135

136136
if (IS_WINDOWS) {
137137
// Add --user directory
138-
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
139-
// So if `findLocalTool` succeeded above, we must have a conformant `installDir`
140138
const version = path.basename(path.dirname(installDir));
141139
const major = semver.major(version);
142140
const minor = semver.minor(version);
@@ -145,8 +143,8 @@ export async function useCpythonVersion(
145143
architecture === 'x86' &&
146144
(major > 3 || (major === 3 && minor >= 10))
147145
) {
148-
// For Python >= 3.10 and architecture= 'x86', add the architecture-specific folder to the path
149-
const arch = '32';
146+
// For Python >= 3.10 and architecture='x86', add the architecture-specific folder to the path
147+
const arch = '32'; // Only for x86 architecture
150148

151149
const userScriptsDir = path.join(
152150
process.env['APPDATA'] || '',
@@ -156,16 +154,24 @@ export async function useCpythonVersion(
156154
);
157155
core.addPath(userScriptsDir);
158156
} else {
157+
// For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
159158
const userScriptsDir = path.join(
160159
process.env['APPDATA'] || '',
161160
'Python',
162161
`Python${major}${minor}`,
163162
'Scripts'
164163
);
165-
166-
// Add the default path to the environment PATH variable
167164
core.addPath(userScriptsDir);
168165
}
166+
167+
// Dynamically handle case for Python314t
168+
const pythonPath = path.join(
169+
process.env['APPDATA'] || '',
170+
'Python',
171+
`Python${major}${minor}t`,
172+
'Scripts'
173+
);
174+
core.addPath(pythonPath);
169175
}
170176
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
171177
}

0 commit comments

Comments
 (0)
0