diff --git a/dev-infra/ng-dev.js b/dev-infra/ng-dev.js index 60f4eef9cf..e24281c5ef 100755 --- a/dev-infra/ng-dev.js +++ b/dev-infra/ng-dev.js @@ -6772,16 +6772,16 @@ class ReleaseTool { }); } /** - * Verifies the current environment contains /usr/bin/python which points to the Python3 - * interpreter. python is required by our tooling in bazel as it contains scripts setting - * `#! /usr/bin/env python`. - * + * Verifies that Python can be resolved within scripts and points to a compatible version. Python + * is required in Bazel actions as there can be tools (such as `skydoc`) that rely on it. * @returns a boolean indicating success or failure. */ _verifyEnvironmentHasPython3Symlink() { return tslib.__awaiter(this, void 0, void 0, function* () { try { - const pyVersion = yield spawnWithDebugOutput('/usr/bin/python', ['--version'], { mode: 'silent' }); + // Note: We do not rely on `/usr/bin/env` but rather access the `env` binary directly as it + // should be part of the shell's `$PATH`. This is necessary for compatibility with Windows. + const pyVersion = yield spawnWithDebugOutput('env', ['python', '--version'], { mode: 'silent' }); const version = pyVersion.stdout.trim() || pyVersion.stderr.trim(); if (version.startsWith('Python 3.')) { debug(`Local python version: ${version}`); diff --git a/dev-infra/release/publish/index.ts b/dev-infra/release/publish/index.ts index 64b72a810c..061d7f5aab 100644 --- a/dev-infra/release/publish/index.ts +++ b/dev-infra/release/publish/index.ts @@ -130,16 +130,16 @@ export class ReleaseTool { } /** - * Verifies the current environment contains /usr/bin/python which points to the Python3 - * interpreter. python is required by our tooling in bazel as it contains scripts setting - * `#! /usr/bin/env python`. - * + * Verifies that Python can be resolved within scripts and points to a compatible version. Python + * is required in Bazel actions as there can be tools (such as `skydoc`) that rely on it. * @returns a boolean indicating success or failure. */ private async _verifyEnvironmentHasPython3Symlink(): Promise { try { + // Note: We do not rely on `/usr/bin/env` but rather access the `env` binary directly as it + // should be part of the shell's `$PATH`. This is necessary for compatibility with Windows. const pyVersion = - await spawnWithDebugOutput('/usr/bin/python', ['--version'], {mode: 'silent'}); + await spawnWithDebugOutput('env', ['python', '--version'], {mode: 'silent'}); const version = pyVersion.stdout.trim() || pyVersion.stderr.trim(); if (version.startsWith('Python 3.')) { debug(`Local python version: ${version}`);