Skip to content

Commit ac99d7e

Browse files
authored
gh-133512: Adds warnings to py.exe launcher about subcommands belonging to Python install manager (GH-133514)
1 parent 3f93295 commit ac99d7e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add warnings to :ref:`launcher` about use of subcommands belonging to the
2+
Python install manager.

PC/launcher2.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ checkShebang(SearchInfo *search)
10581058
debug(L"# Failed to open %s for shebang parsing (0x%08X)\n",
10591059
scriptFile, GetLastError());
10601060
free(scriptFile);
1061-
return 0;
1061+
return RC_NO_SCRIPT;
10621062
}
10631063

10641064
DWORD bytesRead = 0;
@@ -2665,6 +2665,21 @@ performSearch(SearchInfo *search, EnvironmentInfo **envs)
26652665
case RC_NO_SHEBANG:
26662666
case RC_RECURSIVE_SHEBANG:
26672667
break;
2668+
case RC_NO_SCRIPT:
2669+
if (!_comparePath(search->scriptFile, search->scriptFileLength, L"install", -1) ||
2670+
!_comparePath(search->scriptFile, search->scriptFileLength, L"uninstall", -1) ||
2671+
!_comparePath(search->scriptFile, search->scriptFileLength, L"list", -1) ||
2672+
!_comparePath(search->scriptFile, search->scriptFileLength, L"help", -1)) {
2673+
fprintf(
2674+
stderr,
2675+
"WARNING: The '%.*ls' command is unavailable because this is the legacy py.exe command.\n"
2676+
"If you have already installed the Python install manager, open Installed Apps and "
2677+
"remove 'Python Launcher' to enable the new py.exe command.\n",
2678+
search->scriptFileLength,
2679+
search->scriptFile
2680+
);
2681+
}
2682+
break;
26682683
default:
26692684
return exitCode;
26702685
}

0 commit comments

Comments
 (0)