mirror of
https://github.com/actions/setup-python.git
synced 2025-04-19 19:33:29 +00:00
Get rid of the duplicate
This commit is contained in:
parent
d4d6125cf2
commit
c09af9d29f
29
dist/setup/index.js
vendored
29
dist/setup/index.js
vendored
@ -65919,9 +65919,9 @@ class PipCache extends cache_distributor_1.default {
|
||||
let primaryKey = '';
|
||||
let restoreKey = '';
|
||||
if (utils_1.IS_LINUX) {
|
||||
const osRelease = yield utils_1.getLinuxOSReleaseInfo();
|
||||
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
||||
restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`;
|
||||
const osInfo = yield utils_1.getLinuxInfo();
|
||||
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osInfo.osVersion}-${osInfo.osName}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
||||
restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osInfo.osVersion}-${osInfo.osName}-python-${this.pythonVersion}-${this.packageManager}`;
|
||||
}
|
||||
else {
|
||||
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
||||
@ -66379,7 +66379,7 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
|
||||
if (!installDir) {
|
||||
const osInfo = yield utils_1.getOSInfo();
|
||||
throw new Error([
|
||||
`The version '${version}' with architecture '${architecture}' was not found for ${osInfo ? osInfo : 'this operating system'}.`,
|
||||
`The version '${version}' with architecture '${architecture}' was not found for ${osInfo ? `${osInfo.osName} ${osInfo.osVersion}` : 'this operating system'}.`,
|
||||
`The list of all available versions can be found here: ${installer.MANIFEST_URL}`
|
||||
].join(os.EOL));
|
||||
}
|
||||
@ -66952,7 +66952,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getOSInfo = exports.logWarning = exports.getLinuxOSReleaseInfo = exports.isCacheFeatureAvailable = exports.isGhes = exports.validatePythonVersionFormatForPyPy = exports.writeExactPyPyVersionFile = exports.readExactPyPyVersionFile = exports.getPyPyVersionFromPath = exports.isNightlyKeyword = exports.validateVersion = exports.createSymlinkInFolder = exports.WINDOWS_PLATFORMS = exports.WINDOWS_ARCHS = exports.IS_MAC = exports.IS_LINUX = exports.IS_WINDOWS = void 0;
|
||||
exports.getOSInfo = exports.getLinuxInfo = exports.logWarning = exports.isCacheFeatureAvailable = exports.isGhes = exports.validatePythonVersionFormatForPyPy = exports.writeExactPyPyVersionFile = exports.readExactPyPyVersionFile = exports.getPyPyVersionFromPath = exports.isNightlyKeyword = exports.validateVersion = exports.createSymlinkInFolder = exports.WINDOWS_PLATFORMS = exports.WINDOWS_ARCHS = exports.IS_MAC = exports.IS_LINUX = exports.IS_WINDOWS = void 0;
|
||||
const cache = __importStar(__nccwpck_require__(7799));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
@ -67043,17 +67043,6 @@ function isCacheFeatureAvailable() {
|
||||
return true;
|
||||
}
|
||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
||||
function getLinuxOSReleaseInfo() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { stdout, stderr, exitCode } = yield exec.getExecOutput('lsb_release', ['-i', '-r', '-s'], {
|
||||
silent: true
|
||||
});
|
||||
const [osRelease, osVersion] = stdout.trim().split('\n');
|
||||
core.debug(`OS Release: ${osRelease}, Version: ${osVersion}`);
|
||||
return `${osVersion}-${osRelease}`;
|
||||
});
|
||||
}
|
||||
exports.getLinuxOSReleaseInfo = getLinuxOSReleaseInfo;
|
||||
function logWarning(message) {
|
||||
const warningPrefix = '[warning]';
|
||||
core.info(`${warningPrefix}${message}`);
|
||||
@ -67065,7 +67054,7 @@ function getWindowsInfo() {
|
||||
silent: true
|
||||
});
|
||||
const windowsVersion = stdout.trim().split(' ')[3];
|
||||
return `Windows ${windowsVersion}`;
|
||||
return { osName: "Windows", osVersion: windowsVersion };
|
||||
});
|
||||
}
|
||||
function getMacOSInfo() {
|
||||
@ -67074,7 +67063,7 @@ function getMacOSInfo() {
|
||||
silent: true
|
||||
});
|
||||
const macOSVersion = stdout.trim();
|
||||
return `macOS ${macOSVersion}`;
|
||||
return { osName: "macOS", osVersion: macOSVersion };
|
||||
});
|
||||
}
|
||||
function getLinuxInfo() {
|
||||
@ -67083,9 +67072,11 @@ function getLinuxInfo() {
|
||||
silent: true
|
||||
});
|
||||
const [osName, osVersion] = stdout.trim().split('\n');
|
||||
return `${osName} ${osVersion}`;
|
||||
core.debug(`OS Name: ${osName}, Version: ${osVersion}`);
|
||||
return { osName: osName, osVersion: osVersion };
|
||||
});
|
||||
}
|
||||
exports.getLinuxInfo = getLinuxInfo;
|
||||
function getOSInfo() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let osInfo;
|
||||
|
@ -7,7 +7,7 @@ import * as path from 'path';
|
||||
import os from 'os';
|
||||
|
||||
import CacheDistributor from './cache-distributor';
|
||||
import {getLinuxOSReleaseInfo, IS_LINUX, IS_WINDOWS} from '../utils';
|
||||
import {getLinuxInfo, IS_LINUX, IS_WINDOWS} from '../utils';
|
||||
|
||||
class PipCache extends CacheDistributor {
|
||||
constructor(
|
||||
@ -61,9 +61,9 @@ class PipCache extends CacheDistributor {
|
||||
let restoreKey = '';
|
||||
|
||||
if (IS_LINUX) {
|
||||
const osRelease = await getLinuxOSReleaseInfo();
|
||||
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
||||
restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`;
|
||||
const osInfo = await getLinuxInfo();
|
||||
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osInfo.osVersion}-${osInfo.osName}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
||||
restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osInfo.osVersion}-${osInfo.osName}-python-${this.pythonVersion}-${this.packageManager}`;
|
||||
} else {
|
||||
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
||||
restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`;
|
||||
|
@ -89,7 +89,9 @@ export async function useCpythonVersion(
|
||||
throw new Error(
|
||||
[
|
||||
`The version '${version}' with architecture '${architecture}' was not found for ${
|
||||
osInfo ? osInfo : 'this operating system'
|
||||
osInfo
|
||||
? `${osInfo.osName} ${osInfo.osVersion}`
|
||||
: 'this operating system'
|
||||
}.`,
|
||||
`The list of all available versions can be found here: ${installer.MANIFEST_URL}`
|
||||
].join(os.EOL)
|
||||
|
26
src/utils.ts
26
src/utils.ts
@ -122,22 +122,6 @@ export function isCacheFeatureAvailable(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function getLinuxOSReleaseInfo() {
|
||||
const {stdout, stderr, exitCode} = await exec.getExecOutput(
|
||||
'lsb_release',
|
||||
['-i', '-r', '-s'],
|
||||
{
|
||||
silent: true
|
||||
}
|
||||
);
|
||||
|
||||
const [osRelease, osVersion] = stdout.trim().split('\n');
|
||||
|
||||
core.debug(`OS Release: ${osRelease}, Version: ${osVersion}`);
|
||||
|
||||
return `${osVersion}-${osRelease}`;
|
||||
}
|
||||
|
||||
export function logWarning(message: string): void {
|
||||
const warningPrefix = '[warning]';
|
||||
core.info(`${warningPrefix}${message}`);
|
||||
@ -154,7 +138,7 @@ async function getWindowsInfo() {
|
||||
|
||||
const windowsVersion = stdout.trim().split(' ')[3];
|
||||
|
||||
return `Windows ${windowsVersion}`;
|
||||
return {osName: 'Windows', osVersion: windowsVersion};
|
||||
}
|
||||
|
||||
async function getMacOSInfo() {
|
||||
@ -164,17 +148,19 @@ async function getMacOSInfo() {
|
||||
|
||||
const macOSVersion = stdout.trim();
|
||||
|
||||
return `macOS ${macOSVersion}`;
|
||||
return {osName: 'macOS', osVersion: macOSVersion};
|
||||
}
|
||||
|
||||
async function getLinuxInfo() {
|
||||
export async function getLinuxInfo() {
|
||||
const {stdout} = await exec.getExecOutput('lsb_release', ['-i', '-r', '-s'], {
|
||||
silent: true
|
||||
});
|
||||
|
||||
const [osName, osVersion] = stdout.trim().split('\n');
|
||||
|
||||
return `${osName} ${osVersion}`;
|
||||
core.debug(`OS Name: ${osName}, Version: ${osVersion}`);
|
||||
|
||||
return {osName: osName, osVersion: osVersion};
|
||||
}
|
||||
|
||||
export async function getOSInfo() {
|
||||
|
Loading…
Reference in New Issue
Block a user