From 388e4a9c162039cb5bc0fbbb85a44c383b52c68e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cgowridurgad=E2=80=9D?= <“hgowridurgad@github.com> Date: Wed, 17 Sep 2025 17:10:45 +0530 Subject: [PATCH] Logic update --- dist/setup/index.js | 13 ++++++------- src/setup-python.ts | 15 ++++++--------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 92f2ee09..6cd80141 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -97951,12 +97951,8 @@ function isPyPyVersion(versionSpec) { function isGraalPyVersion(versionSpec) { return versionSpec.startsWith('graalpy'); } -function installPipPackages() { +function installPipPackages(pipInstall) { return __awaiter(this, void 0, void 0, function* () { - const pipInstall = core.getInput('pip-install'); - if (!pipInstall) { - return; - } core.info(`Installing pip packages: ${pipInstall}`); try { const installArgs = pipInstall.trim().split(/\s+/); @@ -97964,7 +97960,7 @@ function installPipPackages() { core.info('Successfully installed pip packages'); } 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)()) { yield cacheDependencies(cache, pythonVersion); } - yield installPipPackages(); + const pipInstall = core.getInput('pip-install'); + if (pipInstall) { + yield installPipPackages(pipInstall); + } } else { core.warning('The `python-version` input is not set. The version of Python currently in `PATH` will be used.'); diff --git a/src/setup-python.ts b/src/setup-python.ts index 482d9fc1..91a0c176 100644 --- a/src/setup-python.ts +++ b/src/setup-python.ts @@ -23,21 +23,15 @@ function isGraalPyVersion(versionSpec: string) { return versionSpec.startsWith('graalpy'); } -async function installPipPackages() { - const pipInstall = core.getInput('pip-install'); - - if (!pipInstall) { - return; - } +async function installPipPackages(pipInstall: string) { core.info(`Installing pip packages: ${pipInstall}`); - try { const installArgs = pipInstall.trim().split(/\s+/); await exec('python', ['-m', 'pip', 'install', ...installArgs]); core.info('Successfully installed pip packages'); } 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.` + `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()) { await cacheDependencies(cache, pythonVersion); } - await installPipPackages(); + const pipInstall = core.getInput('pip-install'); + if (pipInstall) { + await installPipPackages(pipInstall); + } } else { core.warning( 'The `python-version` input is not set. The version of Python currently in `PATH` will be used.'