4
0
Fork 0
mirror of https://github.com/actions/setup-python.git synced 2025-11-07 05:26:56 +00:00

Logic update

This commit is contained in:
“gowridurgad” 2025-09-17 17:10:45 +05:30
parent cb37554d28
commit 388e4a9c16
2 changed files with 12 additions and 16 deletions

13
dist/setup/index.js vendored
View file

@ -97951,12 +97951,8 @@ function isPyPyVersion(versionSpec) {
function isGraalPyVersion(versionSpec) { function isGraalPyVersion(versionSpec) {
return versionSpec.startsWith('graalpy'); return versionSpec.startsWith('graalpy');
} }
function installPipPackages() { function installPipPackages(pipInstall) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const pipInstall = core.getInput('pip-install');
if (!pipInstall) {
return;
}
core.info(`Installing pip packages: ${pipInstall}`); core.info(`Installing pip packages: ${pipInstall}`);
try { try {
const installArgs = pipInstall.trim().split(/\s+/); const installArgs = pipInstall.trim().split(/\s+/);
@ -97964,7 +97960,7 @@ function installPipPackages() {
core.info('Successfully installed pip packages'); core.info('Successfully installed pip packages');
} }
catch (error) { catch (error) {
core.setFailed(`Failed to install pip packages from "${pipInstall}". Please verify that the package names, versions, or requirements files provided are correct, that the specified packages and versions can be resolved from PyPI or the configured package index, and that your network connection is stable and allows access to the package index.`); core.setFailed(`Failed to install pip packages from "${pipInstall}". Please verify that the package names, versions, or requirements files provided are correct and installable, that the specified packages and versions can be resolved from PyPI or the configured package index, and that your network connection is stable and allows access to the package index.`);
} }
}); });
} }
@ -98056,7 +98052,10 @@ function run() {
if (cache && (0, utils_1.isCacheFeatureAvailable)()) { if (cache && (0, utils_1.isCacheFeatureAvailable)()) {
yield cacheDependencies(cache, pythonVersion); yield cacheDependencies(cache, pythonVersion);
} }
yield installPipPackages(); const pipInstall = core.getInput('pip-install');
if (pipInstall) {
yield installPipPackages(pipInstall);
}
} }
else { else {
core.warning('The `python-version` input is not set. The version of Python currently in `PATH` will be used.'); core.warning('The `python-version` input is not set. The version of Python currently in `PATH` will be used.');

View file

@ -23,21 +23,15 @@ function isGraalPyVersion(versionSpec: string) {
return versionSpec.startsWith('graalpy'); return versionSpec.startsWith('graalpy');
} }
async function installPipPackages() { async function installPipPackages(pipInstall: string) {
const pipInstall = core.getInput('pip-install');
if (!pipInstall) {
return;
}
core.info(`Installing pip packages: ${pipInstall}`); core.info(`Installing pip packages: ${pipInstall}`);
try { try {
const installArgs = pipInstall.trim().split(/\s+/); const installArgs = pipInstall.trim().split(/\s+/);
await exec('python', ['-m', 'pip', 'install', ...installArgs]); await exec('python', ['-m', 'pip', 'install', ...installArgs]);
core.info('Successfully installed pip packages'); core.info('Successfully installed pip packages');
} catch (error) { } catch (error) {
core.setFailed( core.setFailed(
`Failed to install pip packages from "${pipInstall}". Please verify that the package names, versions, or requirements files provided are correct, that the specified packages and versions can be resolved from PyPI or the configured package index, and that your network connection is stable and allows access to the package index.` `Failed to install pip packages from "${pipInstall}". Please verify that the package names, versions, or requirements files provided are correct and installable, that the specified packages and versions can be resolved from PyPI or the configured package index, and that your network connection is stable and allows access to the package index.`
); );
} }
} }
@ -165,7 +159,10 @@ async function run() {
if (cache && isCacheFeatureAvailable()) { if (cache && isCacheFeatureAvailable()) {
await cacheDependencies(cache, pythonVersion); await cacheDependencies(cache, pythonVersion);
} }
await installPipPackages(); const pipInstall = core.getInput('pip-install');
if (pipInstall) {
await installPipPackages(pipInstall);
}
} else { } else {
core.warning( core.warning(
'The `python-version` input is not set. The version of Python currently in `PATH` will be used.' 'The `python-version` input is not set. The version of Python currently in `PATH` will be used.'