@@ -95950,6 +95950,7 @@ const semver = __importStar(__nccwpck_require__(2088));
95950
95950
const installer = __importStar(__nccwpck_require__(1919));
95951
95951
const core = __importStar(__nccwpck_require__(7484));
95952
95952
const tc = __importStar(__nccwpck_require__(3472));
95953
+ const exec = __importStar(__nccwpck_require__(5236));
95953
95954
// Python has "scripts" or "bin" directories where command-line tools that come with packages are installed.
95954
95955
// This is where pip is, along with anything that pip installs.
95955
95956
// There is a separate directory for `pip install --user`.
@@ -95970,6 +95971,7 @@ function binDir(installDir) {
95970
95971
return path.join(installDir, 'bin');
95971
95972
}
95972
95973
}
95974
+ <<<<<<< HEAD
95973
95975
async function useCpythonVersion(version, architecture, updateEnvironment, checkLatest, allowPreReleases, freethreaded) {
95974
95976
let manifest = null;
95975
95977
const { version: desugaredVersionSpec, freethreaded: versionFreethreaded } = desugarVersion(version);
@@ -95990,6 +95992,31 @@ async function useCpythonVersion(version, architecture, updateEnvironment, check
95990
95992
if (resolvedVersion) {
95991
95993
semanticVersionSpec = resolvedVersion;
95992
95994
core.info(`Resolved as '${semanticVersionSpec}'`);
95995
+ =======
95996
+ function installPip(pythonLocation) {
95997
+ return __awaiter(this, void 0, void 0, function* () {
95998
+ const pipVersion = core.getInput('pip-version');
95999
+ // Validate pip-version format: major[.minor][.patch]
96000
+ const versionRegex = /^\d+(\.\d+)?(\.\d+)?$/;
96001
+ if (pipVersion && !versionRegex.test(pipVersion)) {
96002
+ throw new Error(`Invalid pip-version "${pipVersion}". Please specify a version in the format major[.minor][.patch].`);
96003
+ }
96004
+ if (pipVersion) {
96005
+ core.info(`pip-version input is specified. Installing pip version ${pipVersion}`);
96006
+ yield exec.exec(`${pythonLocation}/python -m pip install --upgrade pip==${pipVersion} --disable-pip-version-check --no-warn-script-location`);
96007
+ }
96008
+ });
96009
+ }
96010
+ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest, allowPreReleases, freethreaded) {
96011
+ return __awaiter(this, void 0, void 0, function* () {
96012
+ var _a;
96013
+ let manifest = null;
96014
+ const { version: desugaredVersionSpec, freethreaded: versionFreethreaded } = desugarVersion(version);
96015
+ let semanticVersionSpec = pythonVersionToSemantic(desugaredVersionSpec, allowPreReleases);
96016
+ if (versionFreethreaded) {
96017
+ // Use the freethreaded version if it was specified in the input, e.g., 3.13t
96018
+ freethreaded = true;
96019
+ >>>>>>> e9c40fb (Add support for `pip-version` (#1129))
95993
96020
}
95994
96021
else {
95995
96022
core.info(`Failed to resolve version ${semanticVersionSpec} from manifest`);
@@ -96053,6 +96080,7 @@ async function useCpythonVersion(version, architecture, updateEnvironment, check
96053
96080
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
96054
96081
core.addPath(userScriptsDir);
96055
96082
}
96083
+ <<<<<<< HEAD
96056
96084
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
96057
96085
}
96058
96086
const installed = versionFromPath(installDir);
@@ -96064,6 +96092,70 @@ async function useCpythonVersion(version, architecture, updateEnvironment, check
96064
96092
core.setOutput('python-version', pythonVersion);
96065
96093
core.setOutput('python-path', pythonPath);
96066
96094
return { impl: 'CPython', version: pythonVersion };
96095
+ =======
96096
+ if (!installDir) {
96097
+ const osInfo = yield (0, utils_1.getOSInfo)();
96098
+ const msg = [
96099
+ `The version '${version}' with architecture '${architecture}' was not found for ${osInfo
96100
+ ? `${osInfo.osName} ${osInfo.osVersion}`
96101
+ : 'this operating system'}.`
96102
+ ];
96103
+ if (freethreaded) {
96104
+ msg.push(`Free threaded versions are only available for Python 3.13.0 and later.`);
96105
+ }
96106
+ msg.push(`The list of all available versions can be found here: ${installer.MANIFEST_URL}`);
96107
+ throw new Error(msg.join(os.EOL));
96108
+ }
96109
+ const _binDir = binDir(installDir);
96110
+ const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
96111
+ const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`);
96112
+ if (updateEnvironment) {
96113
+ core.exportVariable('pythonLocation', installDir);
96114
+ core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig');
96115
+ core.exportVariable('pythonLocation', installDir);
96116
+ // https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
96117
+ core.exportVariable('Python_ROOT_DIR', installDir);
96118
+ // https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2
96119
+ core.exportVariable('Python2_ROOT_DIR', installDir);
96120
+ // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3
96121
+ core.exportVariable('Python3_ROOT_DIR', installDir);
96122
+ core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig');
96123
+ if (utils_1.IS_LINUX) {
96124
+ const libPath = process.env.LD_LIBRARY_PATH
96125
+ ? `:${process.env.LD_LIBRARY_PATH}`
96126
+ : '';
96127
+ const pyLibPath = path.join(installDir, 'lib');
96128
+ if (!libPath.split(':').includes(pyLibPath)) {
96129
+ core.exportVariable('LD_LIBRARY_PATH', pyLibPath + libPath);
96130
+ }
96131
+ }
96132
+ core.addPath(installDir);
96133
+ core.addPath(_binDir);
96134
+ if (utils_1.IS_WINDOWS) {
96135
+ // Add --user directory
96136
+ // `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
96137
+ // So if `findLocalTool` succeeded above, we must have a conformant `installDir`
96138
+ const version = path.basename(path.dirname(installDir));
96139
+ const major = semver.major(version);
96140
+ const minor = semver.minor(version);
96141
+ const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
96142
+ core.addPath(userScriptsDir);
96143
+ }
96144
+ // On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
96145
+ }
96146
+ const installed = versionFromPath(installDir);
96147
+ let pythonVersion = installed;
96148
+ if (freethreaded) {
96149
+ // Add the freethreaded suffix to the version (e.g., 3.13.1t)
96150
+ pythonVersion += 't';
96151
+ }
96152
+ core.setOutput('python-version', pythonVersion);
96153
+ core.setOutput('python-path', pythonPath);
96154
+ const binaryPath = utils_1.IS_WINDOWS ? installDir : _binDir;
96155
+ yield installPip(binaryPath);
96156
+ return { impl: 'CPython', version: pythonVersion };
96157
+ });
96158
+ >>>>>>> e9c40fb (Add support for `pip-version` (#1129))
96067
96159
}
96068
96160
/* Desugar free threaded and dev versions */
96069
96161
function desugarVersion(versionSpec) {
0 commit comments