gh-133512: Adds warnings to py.exe launcher about subcommands belonging to Python install manager (GH-133514)

This commit is contained in:
Steve Dower 2025-05-07 13:24:33 +01:00 committed by GitHub
parent 3f93295bbe
commit ac99d7e5cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,2 @@
Add warnings to :ref:`launcher` about use of subcommands belonging to the
Python install manager.

View file

@ -1058,7 +1058,7 @@ checkShebang(SearchInfo *search)
debug(L"# Failed to open %s for shebang parsing (0x%08X)\n",
scriptFile, GetLastError());
free(scriptFile);
return 0;
return RC_NO_SCRIPT;
}
DWORD bytesRead = 0;
@ -2665,6 +2665,21 @@ performSearch(SearchInfo *search, EnvironmentInfo **envs)
case RC_NO_SHEBANG:
case RC_RECURSIVE_SHEBANG:
break;
case RC_NO_SCRIPT:
if (!_comparePath(search->scriptFile, search->scriptFileLength, L"install", -1) ||
!_comparePath(search->scriptFile, search->scriptFileLength, L"uninstall", -1) ||
!_comparePath(search->scriptFile, search->scriptFileLength, L"list", -1) ||
!_comparePath(search->scriptFile, search->scriptFileLength, L"help", -1)) {
fprintf(
stderr,
"WARNING: The '%.*ls' command is unavailable because this is the legacy py.exe command.\n"
"If you have already installed the Python install manager, open Installed Apps and "
"remove 'Python Launcher' to enable the new py.exe command.\n",
search->scriptFileLength,
search->scriptFile
);
}
break;
default:
return exitCode;
}