Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit532b046

Browse files
Add Architecture-Specific PATH Management for Python with --user Flag on Windows (#1122)
* logic to update install oath with --user flg* format update* format update* update* test job to validate --user flag installtion* updated the script* updated the yaml* update the inputs* updated script* update the correct script file name* updated script and yaml* npm run format-check* fix-test failures* path update* check failure fix* updated test* update free threaded version* updated the comments
1 parent1264885 commit532b046

File tree

4 files changed

+52
-9
lines changed

4 files changed

+52
-9
lines changed

‎.github/workflows/e2e-cache-freethreaded.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
macos-latest,
5959
macos-13
6060
]
61-
python-version:[3.13.0t, 3.13.1t, 3.13.2t]
61+
python-version:[3.13.1t, 3.13.2t, 3.13.5t]
6262
steps:
6363
-uses:actions/checkout@v4
6464
-name:Setup Python
@@ -148,7 +148,7 @@ jobs:
148148
macos-latest,
149149
macos-13
150150
]
151-
python-version:[3.13.0t, 3.13.1t, 3.13.2t]
151+
python-version:[3.13.1t, 3.13.2t, 3.13.5t]
152152
steps:
153153
-uses:actions/checkout@v4
154154
-name:Setup Python

‎.github/workflows/e2e-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
-name:Verify 3.9.13
3939
run:python __tests__/verify-python.py 3.9.13
4040

41-
-name:Run with setup-python 3.9.13
41+
-name:Run with setup-python 3.10.11
4242
uses:./
4343
with:
4444
python-version:3.10.11
@@ -89,6 +89,7 @@ jobs:
8989
python-version:'<3.13'
9090
-name:Verify <3.13
9191
run:python __tests__/verify-python.py 3.12
92+
9293
-name:Test Raw Endpoint Access
9394
run:|
9495
curl -L https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json | jq empty

‎dist/setup/index.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96103,11 +96103,32 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
9610396103
if (utils_1.IS_WINDOWS) {
9610496104
// Add --user directory
9610596105
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
96106-
//So if `findLocalTool` succeeded above, we must have a conformant `installDir`
96106+
//Extract version details
9610796107
const version = path.basename(path.dirname(installDir));
9610896108
const major = semver.major(version);
9610996109
const minor = semver.minor(version);
96110-
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
96110+
const basePath = process.env['APPDATA'] || '';
96111+
let versionSuffix = `${major}${minor}`;
96112+
// Append '-32' for x86 architecture if Python version is >= 3.10
96113+
if (architecture === 'x86' &&
96114+
(major > 3 || (major === 3 && minor >= 10))) {
96115+
versionSuffix += '-32';
96116+
}
96117+
else if (architecture === 'arm64') {
96118+
versionSuffix += '-arm64';
96119+
}
96120+
// Append 't' for freethreaded builds
96121+
if (freethreaded) {
96122+
versionSuffix += 't';
96123+
if (architecture === 'x86-freethreaded') {
96124+
versionSuffix += '-32';
96125+
}
96126+
else if (architecture === 'arm64-freethreaded') {
96127+
versionSuffix += '-arm64';
96128+
}
96129+
}
96130+
// Add user Scripts path
96131+
const userScriptsDir = path.join(basePath, 'Python', `Python${versionSuffix}`, 'Scripts');
9611196132
core.addPath(userScriptsDir);
9611296133
}
9611396134
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.

‎src/find-python.ts

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ export async function useCpythonVersion(
7171
// Use the freethreaded version if it was specified in the input, e.g., 3.13t
7272
freethreaded=true;
7373
}
74-
core.debug(`Semantic version spec of${version} is${semanticVersionSpec}`);
7574

75+
core.debug(`Semantic version spec of${version} is${semanticVersionSpec}`);
7676
if(freethreaded){
7777
// Free threaded versions use an architecture suffix like `x64-freethreaded`
7878
core.debug(`Using freethreaded version of${semanticVersionSpec}`);
@@ -176,15 +176,36 @@ export async function useCpythonVersion(
176176
if(IS_WINDOWS){
177177
// Add --user directory
178178
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
179-
//So if `findLocalTool` succeeded above, we must have a conformant `installDir`
179+
//Extract version details
180180
constversion=path.basename(path.dirname(installDir));
181181
constmajor=semver.major(version);
182182
constminor=semver.minor(version);
183183

184+
constbasePath=process.env['APPDATA']||'';
185+
letversionSuffix=`${major}${minor}`;
186+
// Append '-32' for x86 architecture if Python version is >= 3.10
187+
if(
188+
architecture==='x86'&&
189+
(major>3||(major===3&&minor>=10))
190+
){
191+
versionSuffix+='-32';
192+
}elseif(architecture==='arm64'){
193+
versionSuffix+='-arm64';
194+
}
195+
// Append 't' for freethreaded builds
196+
if(freethreaded){
197+
versionSuffix+='t';
198+
if(architecture==='x86-freethreaded'){
199+
versionSuffix+='-32';
200+
}elseif(architecture==='arm64-freethreaded'){
201+
versionSuffix+='-arm64';
202+
}
203+
}
204+
// Add user Scripts path
184205
constuserScriptsDir=path.join(
185-
process.env['APPDATA']||'',
206+
basePath,
186207
'Python',
187-
`Python${major}${minor}`,
208+
`Python${versionSuffix}`,
188209
'Scripts'
189210
);
190211
core.addPath(userScriptsDir);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp