mirror of
https://github.com/actions/setup-python.git
synced 2025-07-22 20:08:19 +02:00
fixing comments
This commit is contained in:
parent
17904c7b69
commit
0130854fbc
4 changed files with 91 additions and 43 deletions
|
@ -22,18 +22,18 @@ async function cacheDependencies(cache: string, pythonVersion: string) {
|
|||
await cacheDistributor.restoreCache();
|
||||
}
|
||||
|
||||
function resolveVersionInput(): string | string[] {
|
||||
let version: string | string[] = core.getMultilineInput('python-version');
|
||||
function resolveVersionInput() {
|
||||
let versions = core.getMultilineInput('python-version');
|
||||
let versionFile = core.getInput('python-version-file');
|
||||
|
||||
if (version.length && versionFile) {
|
||||
if (versions.length && versionFile) {
|
||||
core.warning(
|
||||
'Both python-version and python-version-file inputs are specified, only python-version will be used.'
|
||||
);
|
||||
}
|
||||
|
||||
if (version.length) {
|
||||
return version;
|
||||
if (versions.length) {
|
||||
return versions;
|
||||
}
|
||||
|
||||
if (versionFile) {
|
||||
|
@ -42,9 +42,9 @@ function resolveVersionInput(): string | string[] {
|
|||
`The specified python version file at: ${versionFile} doesn't exist.`
|
||||
);
|
||||
}
|
||||
version = fs.readFileSync(versionFile, 'utf8');
|
||||
const version = fs.readFileSync(versionFile, 'utf8');
|
||||
core.info(`Resolved ${versionFile} as ${version}`);
|
||||
return version;
|
||||
return [version];
|
||||
}
|
||||
|
||||
logWarning(
|
||||
|
@ -52,14 +52,14 @@ function resolveVersionInput(): string | string[] {
|
|||
);
|
||||
versionFile = '.python-version';
|
||||
if (fs.existsSync(versionFile)) {
|
||||
version = fs.readFileSync(versionFile, 'utf8');
|
||||
const version = fs.readFileSync(versionFile, 'utf8');
|
||||
core.info(`Resolved ${versionFile} as ${version}`);
|
||||
return version;
|
||||
return [version];
|
||||
}
|
||||
|
||||
logWarning(`${versionFile} doesn't exist.`);
|
||||
|
||||
return version;
|
||||
return versions;
|
||||
}
|
||||
|
||||
async function run() {
|
||||
|
@ -75,21 +75,14 @@ async function run() {
|
|||
`Python is expected to be installed into ${process.env['RUNNER_TOOL_CACHE']}`
|
||||
);
|
||||
try {
|
||||
let versions: string[];
|
||||
const resolvedVersionInput = resolveVersionInput();
|
||||
const versions = resolveVersionInput();
|
||||
const checkLatest = core.getBooleanInput('check-latest');
|
||||
|
||||
if (Array.isArray(resolvedVersionInput)) {
|
||||
versions = resolvedVersionInput as string[];
|
||||
} else {
|
||||
versions = [resolvedVersionInput as string];
|
||||
}
|
||||
|
||||
if (versions.length) {
|
||||
let pythonVersion = '';
|
||||
const arch: string = core.getInput('architecture') || os.arch();
|
||||
const updateEnvironment = core.getBooleanInput('update-environment');
|
||||
for (const version of versions) {
|
||||
const arch: string = core.getInput('architecture') || os.arch();
|
||||
const updateEnvironment = core.getBooleanInput('update-environment');
|
||||
if (isPyPyVersion(version)) {
|
||||
const installed = await finderPyPy.findPyPyVersion(
|
||||
version,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue