8000 update the install path for free-threaded · actions/setup-python@da44513 · GitHub
[go: up one dir, main page]

Skip to content

Commit da44513

Browse files
update the install path for free-threaded
1 parent feb0ff9 commit da44513

File tree

2 files changed

+48
-19
lines changed

2 files changed

+48
-19
lines changed

dist/setup/index.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99613,17 +99613,28 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
9961399613
(major > 3 || (major === 3 && minor >= 10))) {
9961499614
// For Python >= 3.10 and architecture='x86', add the architecture-specific folder to the path
9961599615
const arch = '32'; // Only for x86 architecture
99616-
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}-${arch}`, 'Scripts');
99617-
core.addPath(userScriptsDir);
99616+
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}-${arch}`, 'Scripts');
99617+
core.addPath(pythonPath);
9961899618
}
9961999619
else {
9962099620
// For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
99621-
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
99622-
core.addPath(userScriptsDir);
99621+
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
99622+
core.addPath(pythonPath);
99623+
}
99624+
if (architecture === 'x86' &&
99625+
(major > 3 || (major === 3 && minor >= 10))) {
99626+
// For Python >= 3.10 and architecture='x86', add the architecture-specific folder to the path
99627+
const arch = '32'; // Only for x86 architecture
99628+
// Dynamically handle case for Python314t
99629+
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}t--${arch}`, 'Scripts');
99630+
core.addPath(pythonPath);
99631+
}
99632+
else {
99633+
// For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
99634+
// Dynamically handle case for Python314t
99635+
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}t`, 'Scripts');
99636+
core.addPath(pythonPath);
9962399637
}
99624-
// Dynamically handle case for Python314t
99625-
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}t`, 'Scripts');
99626-
core.addPath(pythonPath);
9962799638
}
9962899639
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
9962999640
}

src/find-python.ts

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,32 +146,50 @@ export async function useCpythonVersion(
146146
// For Python >= 3.10 and architecture='x86', add the architecture-specific folder to the path
147147
const arch = '32'; // Only for x86 architecture
148148

149-
const userScriptsDir = path.join(
149+
const pythonPath = path.join(
150150
process.env['APPDATA'] || '',
151151
'Python',
152152
`Python${major}${minor}-${arch}`,
153153
'Scripts'
154154
);
155-
core.addPath(userScriptsDir);
155+
core.addPath(pythonPath);
156156
} else {
157157
// For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
158-
const userScriptsDir = path.join(
158+
const pythonPath = path.join(
159159
process.env['APPDATA'] || '',
160160
'Python',
161161
`Python${major}${minor}`,
162162
'Scripts'
163163
);
164-
core.addPath(userScriptsDir);
164+
core.addPath(pythonPath);
165165
}
166166

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);
167+
if (
168+
architecture === 'x86' &&
169+
(major > 3 || (major === 3 && minor >= 10))
170+
) {
171+
// For Python >= 3.10 and architecture='x86', add the architecture-specific folder to the path
172+
const arch = '32'; // Only for x86 architecture
173+
174+
// Dynamically handle case for Python314t
175+
const pythonPath = path.join(
176+
process.env['APPDATA'] || '',
177+
'Python',
178+
`Python${major}${minor}t--${arch}`,
179+
'Scripts'
180+
);
181+
core.addPath(pythonPath);
182+
} else {
183+
// For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
184+
// Dynamically handle case for Python314t
185+
const pythonPath = path.join(
186+
process.env['APPDATA'] || '',
187+
'Python',
188+
`Python${major}${minor}t`,
189+
'Scripts'
190+
);
191+
core.addPath(pythonPath);
192+
}
175193
}
176194
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
177195
}

0 commit comments

Comments
 (0)
0