Skip to content

Add Architecture-Specific PATH Management for Python with --user Flag on Windows for x86 #1039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
bd89e34
update-install path --user flag for x86 for >=3.10
aparnajyothi-y Feb 19, 2025
feb0ff9
update-install-path-freethreaded
aparnajyothi-y Mar 25, 2025
da44513
update the install path for free-threaded
aparnajyothi-y Mar 25, 2025
72794c8
Support free threaded Python versions like '3.13t' (#973)
colesbury Mar 4, 2025
6a33031
Bump @actions/glob from 0.4.0 to 0.5.0 (#1015)
dependabot[bot] Mar 12, 2025
0704aaf
Add support for .tool-versions file in setup-python (#1043)
mahabaleshwars Mar 13, 2025
12c4557
Add e2e Testing for free threaded and Bump @action/cache from 4.0.0 t…
priya-kinthali Mar 24, 2025
56f2fac
Remove Ubuntu 20.04 from workflows due to deprecation from 2025-04-15…
aparnajyothi-y Apr 11, 2025
358da85
Fix for Candidate Not Iterable Error (#1082)
aparnajyothi-y Apr 17, 2025
4260a61
update the logic for free threaded also
aparnajyothi-y Apr 22, 2025
1df3e33
logic update
aparnajyothi-y Apr 22, 2025
68111ac
Merge remote-tracking branch 'origin/main' into update-install-path
aparnajyothi-y Apr 22, 2025
114b468
code update for free threaded
aparnajyothi-y Apr 28, 2025
c614f62
resolve conflicts
aparnajyothi-y Apr 28, 2025
404bd3b
update the logic
aparnajyothi-y Apr 30, 2025
0b865b9
code update for freethreaded
aparnajyothi-y May 2, 2025
3d7ca5f
updated code logic for arm64
aparnajyothi-y May 9, 2025
9d11fda
update the logic to allow x86-freethreaded, arm64-freethreaded, x64-f…
aparnajyothi-y Jun 5, 2025
b26f6d0
Added architecture validation validated for freethreaded related inputs
aparnajyothi-y Jun 5, 2025
32a58a9
polished the error message
aparnajyothi-y Jun 5, 2025
b22fe06
logic update
aparnajyothi-y Jun 6, 2025
53228cb
logic update
aparnajyothi-y Jun 6, 2025
a14e4fd
file update
aparnajyothi-y Jun 6, 2025
25cabaa
update test
aparnajyothi-y Jun 10, 2025
d5733d0
fix error
aparnajyothi-y Jun 10, 2025
c485907
update the job
aparnajyothi-y Jun 10, 2025
0e3ceed
update test
aparnajyothi-y Jun 10, 2025
aba971c
update test
aparnajyothi-y Jun 10, 2025
d917d21
update
aparnajyothi-y Jun 10, 2025
62b9a91
update
aparnajyothi-y Jun 10, 2025
98eca37
update
aparnajyothi-y Jun 10, 2025
6a1a448
update
aparnajyothi-y Jun 10, 2025
1ab3383
update
aparnajyothi-y Jun 10, 2025
550be36
update
aparnajyothi-y Jun 10, 2025
d02a110
update
aparnajyothi-y Jun 10, 2025
72dc4ca
update
aparnajyothi-y Jun 10, 2025
25f7909
update
aparnajyothi-y Jun 10, 2025
b68779b
update
aparnajyothi-y Jun 10, 2025
b336901
update
aparnajyothi-y Jun 10, 2025
861d4f7
update
aparnajyothi-y Jun 10, 2025
cb89d95
update
aparnajyothi-y Jun 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/workflows/test-python-freethreaded.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
[
macos-latest,
windows-latest,
ubuntu-20.04,
ubuntu-22.04,
ubuntu-22.04-arm,
macos-13,
Expand Down Expand Up @@ -62,7 +61,6 @@ jobs:
[
macos-latest,
windows-latest,
ubuntu-20.04,
ubuntu-22.04,
ubuntu-22.04-arm,
macos-13,
Expand Down Expand Up @@ -103,7 +101,6 @@ jobs:
[
macos-latest,
windows-latest,
ubuntu-20.04,
ubuntu-22.04,
ubuntu-22.04-arm,
macos-13,
Expand Down Expand Up @@ -142,7 +139,6 @@ jobs:
[
macos-latest,
windows-latest,
ubuntu-20.04,
ubuntu-22.04,
ubuntu-22.04-arm,
macos-13,
Expand Down Expand Up @@ -184,7 +180,6 @@ jobs:
[
macos-latest,
windows-latest,
ubuntu-20.04,
ubuntu-22.04,
ubuntu-22.04-arm,
macos-13,
Expand Down Expand Up @@ -226,7 +221,6 @@ jobs:
[
macos-latest,
windows-latest,
ubuntu-20.04,
ubuntu-22.04,
ubuntu-22.04-arm,
macos-13,
Expand Down Expand Up @@ -258,7 +252,6 @@ jobs:
[
macos-latest,
windows-latest,
ubuntu-20.04,
ubuntu-22.04,
ubuntu-22.04-arm,
macos-13,
Expand Down Expand Up @@ -371,7 +364,6 @@ jobs:
[
macos-latest,
windows-latest,
ubuntu-20.04,
ubuntu-22.04,
ubuntu-22.04-arm,
macos-13,
Expand Down Expand Up @@ -461,7 +453,6 @@ jobs:
[
macos-latest,
windows-latest,
ubuntu-20.04,
ubuntu-22.04,
ubuntu-22.04-arm,
macos-13,
Expand Down
21 changes: 17 additions & 4 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96883,13 +96883,26 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
core.addPath(installDir);
core.addPath(_binDir);
if (utils_1.IS_WINDOWS) {
// Add --user directory
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
// So if `findLocalTool` succeeded above, we must have a conformant `installDir`
// Extract version details
const version = path.basename(path.dirname(installDir));
const major = semver.major(version);
const minor = semver.minor(version);
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
const basePath = process.env['APPDATA'] || '';
let versionSuffix = `${major}${minor}`;
// Append '-32' for x86 architecture if Python version is >= 3.10
if (architecture === 'x86' &&
(major > 3 || (major === 3 && minor >= 10))) {
versionSuffix += '-32';
}
// Append 't' for freethreaded builds
if (freethreaded) {
versionSuffix += 't';
if (architecture === 'x86-freethreaded') {
versionSuffix += '-32';
}
}
// Add user Scripts path
const userScriptsDir = path.join(basePath, 'Python', `Python${versionSuffix}`, 'Scripts');
core.addPath(userScriptsDir);
}
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
Expand Down
26 changes: 20 additions & 6 deletions src/find-python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,31 @@ export async function useCpythonVersion(
core.addPath(_binDir);

if (IS_WINDOWS) {
// Add --user directory
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
// So if `findLocalTool` succeeded above, we must have a conformant `installDir`
// Extract version details
const version = path.basename(path.dirname(installDir));
const major = semver.major(version);
const minor = semver.minor(version);

const basePath = process.env['APPDATA'] || '';
let versionSuffix = `${major}${minor}`;
// Append '-32' for x86 architecture if Python version is >= 3.10
if (
architecture === 'x86' &&
(major > 3 || (major === 3 && minor >= 10))
) {
versionSuffix += '-32';
}
// Append 't' for freethreaded builds
if (freethreaded) {
versionSuffix += 't';
if (architecture === 'x86-freethreaded') {
versionSuffix += '-32';
}
}
// Add user Scripts path
const userScriptsDir = path.join(
process.env['APPDATA'] || '',
basePath,
'Python',
`Python${major}${minor}`,
`Python${versionSuffix}`,
'Scripts'
);
core.addPath(userScriptsDir);
Expand Down
Loading