mirror of
https://github.com/actions/setup-python.git
synced 2025-07-05 00:53:46 +00:00
Merge branch 'main' into v-dmshib/fix-poetry-version
This commit is contained in:
commit
2586d59316
11 changed files with 146 additions and 29 deletions
20
dist/setup/index.js
vendored
20
dist/setup/index.js
vendored
|
@ -6073,7 +6073,7 @@ const os = __importStar(__webpack_require__(87));
|
|||
const cache_factory_1 = __webpack_require__(633);
|
||||
const utils_1 = __webpack_require__(163);
|
||||
function isPyPyVersion(versionSpec) {
|
||||
return versionSpec.startsWith('pypy-');
|
||||
return versionSpec.startsWith('pypy');
|
||||
}
|
||||
function cacheDependencies(cache, pythonVersion) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
|
@ -6112,6 +6112,9 @@ function run() {
|
|||
yield cacheDependencies(cache, pythonVersion);
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.warning('The `python-version` input is not set. The version of Python currently in `PATH` will be used.');
|
||||
}
|
||||
const matchersPath = path.join(__dirname, '../..', '.github');
|
||||
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
|
||||
}
|
||||
|
@ -52385,12 +52388,15 @@ function findPyPyVersion(versionSpec, architecture) {
|
|||
}
|
||||
const pipDir = utils_1.IS_WINDOWS ? 'Scripts' : 'bin';
|
||||
const _binDir = path.join(installDir, pipDir);
|
||||
const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
|
||||
const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`);
|
||||
const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir);
|
||||
core.exportVariable('pythonLocation', pythonLocation);
|
||||
core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig');
|
||||
core.addPath(pythonLocation);
|
||||
core.addPath(_binDir);
|
||||
core.setOutput('python-version', 'pypy' + resolvedPyPyVersion.trim());
|
||||
core.setOutput('python-path', pythonPath);
|
||||
return { resolvedPyPyVersion, resolvedPythonVersion };
|
||||
});
|
||||
}
|
||||
|
@ -52421,8 +52427,12 @@ function findPyPyToolCache(pythonVersion, pypyVersion, architecture) {
|
|||
exports.findPyPyToolCache = findPyPyToolCache;
|
||||
function parsePyPyVersion(versionSpec) {
|
||||
const versions = versionSpec.split('-').filter(item => !!item);
|
||||
if (/^(pypy)(.+)/.test(versions[0])) {
|
||||
let pythonVersion = versions[0].replace('pypy', '');
|
||||
versions.splice(0, 1, 'pypy', pythonVersion);
|
||||
}
|
||||
if (versions.length < 2 || versions[0] != 'pypy') {
|
||||
throw new Error("Invalid 'version' property for PyPy. PyPy version should be specified as 'pypy-<python-version>'. See README for examples and documentation.");
|
||||
throw new Error("Invalid 'version' property for PyPy. PyPy version should be specified as 'pypy<python-version>' or 'pypy-<python-version>'. See README for examples and documentation.");
|
||||
}
|
||||
const pythonVersion = versions[1];
|
||||
let pypyVersion;
|
||||
|
@ -57033,8 +57043,11 @@ function useCpythonVersion(version, architecture) {
|
|||
core.exportVariable('LD_LIBRARY_PATH', pyLibPath + libPath);
|
||||
}
|
||||
}
|
||||
const _binDir = binDir(installDir);
|
||||
const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
|
||||
const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`);
|
||||
core.addPath(installDir);
|
||||
core.addPath(binDir(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/
|
||||
|
@ -57048,6 +57061,7 @@ function useCpythonVersion(version, architecture) {
|
|||
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
|
||||
const installed = versionFromPath(installDir);
|
||||
core.setOutput('python-version', installed);
|
||||
core.setOutput('python-path', pythonPath);
|
||||
return { impl: 'CPython', version: installed };
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue