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 primaryKey = '';
|
||||||
let restoreKey = '';
|
let restoreKey = '';
|
||||||
if (utils_1.IS_LINUX) {
|
if (utils_1.IS_LINUX) {
|
||||||
const osRelease = yield utils_1.getLinuxOSReleaseInfo();
|
const osInfo = yield utils_1.getLinuxInfo();
|
||||||
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
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']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`;
|
restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osInfo.osVersion}-${osInfo.osName}-python-${this.pythonVersion}-${this.packageManager}`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
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) {
|
if (!installDir) {
|
||||||
const osInfo = yield utils_1.getOSInfo();
|
const osInfo = yield utils_1.getOSInfo();
|
||||||
throw new Error([
|
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}`
|
`The list of all available versions can be found here: ${installer.MANIFEST_URL}`
|
||||||
].join(os.EOL));
|
].join(os.EOL));
|
||||||
}
|
}
|
||||||
@ -66952,7 +66952,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
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 cache = __importStar(__nccwpck_require__(7799));
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
@ -67043,17 +67043,6 @@ function isCacheFeatureAvailable() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
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) {
|
function logWarning(message) {
|
||||||
const warningPrefix = '[warning]';
|
const warningPrefix = '[warning]';
|
||||||
core.info(`${warningPrefix}${message}`);
|
core.info(`${warningPrefix}${message}`);
|
||||||
@ -67065,7 +67054,7 @@ function getWindowsInfo() {
|
|||||||
silent: true
|
silent: true
|
||||||
});
|
});
|
||||||
const windowsVersion = stdout.trim().split(' ')[3];
|
const windowsVersion = stdout.trim().split(' ')[3];
|
||||||
return `Windows ${windowsVersion}`;
|
return { osName: "Windows", osVersion: windowsVersion };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getMacOSInfo() {
|
function getMacOSInfo() {
|
||||||
@ -67074,7 +67063,7 @@ function getMacOSInfo() {
|
|||||||
silent: true
|
silent: true
|
||||||
});
|
});
|
||||||
const macOSVersion = stdout.trim();
|
const macOSVersion = stdout.trim();
|
||||||
return `macOS ${macOSVersion}`;
|
return { osName: "macOS", osVersion: macOSVersion };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getLinuxInfo() {
|
function getLinuxInfo() {
|
||||||
@ -67083,9 +67072,11 @@ function getLinuxInfo() {
|
|||||||
silent: true
|
silent: true
|
||||||
});
|
});
|
||||||
const [osName, osVersion] = stdout.trim().split('\n');
|
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() {
|
function getOSInfo() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let osInfo;
|
let osInfo;
|
||||||
|
@ -7,7 +7,7 @@ import * as path from 'path';
|
|||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
import CacheDistributor from './cache-distributor';
|
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 {
|
class PipCache extends CacheDistributor {
|
||||||
constructor(
|
constructor(
|
||||||
@ -61,9 +61,9 @@ class PipCache extends CacheDistributor {
|
|||||||
let restoreKey = '';
|
let restoreKey = '';
|
||||||
|
|
||||||
if (IS_LINUX) {
|
if (IS_LINUX) {
|
||||||
const osRelease = await getLinuxOSReleaseInfo();
|
const osInfo = await getLinuxInfo();
|
||||||
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
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']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`;
|
restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osInfo.osVersion}-${osInfo.osName}-python-${this.pythonVersion}-${this.packageManager}`;
|
||||||
} else {
|
} else {
|
||||||
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
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}`;
|
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(
|
throw new Error(
|
||||||
[
|
[
|
||||||
`The version '${version}' with architecture '${architecture}' was not found for ${
|
`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}`
|
`The list of all available versions can be found here: ${installer.MANIFEST_URL}`
|
||||||
].join(os.EOL)
|
].join(os.EOL)
|
||||||
|
26
src/utils.ts
26
src/utils.ts
@ -122,22 +122,6 @@ export function isCacheFeatureAvailable(): boolean {
|
|||||||
return true;
|
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 {
|
export function logWarning(message: string): void {
|
||||||
const warningPrefix = '[warning]';
|
const warningPrefix = '[warning]';
|
||||||
core.info(`${warningPrefix}${message}`);
|
core.info(`${warningPrefix}${message}`);
|
||||||
@ -154,7 +138,7 @@ async function getWindowsInfo() {
|
|||||||
|
|
||||||
const windowsVersion = stdout.trim().split(' ')[3];
|
const windowsVersion = stdout.trim().split(' ')[3];
|
||||||
|
|
||||||
return `Windows ${windowsVersion}`;
|
return {osName: 'Windows', osVersion: windowsVersion};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getMacOSInfo() {
|
async function getMacOSInfo() {
|
||||||
@ -164,17 +148,19 @@ async function getMacOSInfo() {
|
|||||||
|
|
||||||
const macOSVersion = stdout.trim();
|
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'], {
|
const {stdout} = await exec.getExecOutput('lsb_release', ['-i', '-r', '-s'], {
|
||||||
silent: true
|
silent: true
|
||||||
});
|
});
|
||||||
|
|
||||||
const [osName, osVersion] = stdout.trim().split('\n');
|
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() {
|
export async function getOSInfo() {
|
||||||
|
Loading…
Reference in New Issue
Block a user