bpo-34062: Add missing launcher argument and make behavior consistent between short and long arguments (GH-8827)

Added previously missing "--list" argument.
Made "--list" and "--list-paths" behavior consistent with the corresponding "-0" and "-0p" arguments.
This commit is contained in:
Brendan Gerrity 2018-08-31 08:15:42 -07:00 committed by Steve Dower
parent 757b73cf92
commit aada63b20e
2 changed files with 12 additions and 8 deletions

View File

@ -0,0 +1 @@
Fixed the '--list' and '--list-paths' arguments for the py.exe launcher

View File

@ -1466,7 +1466,6 @@ process(int argc, wchar_t ** argv)
wchar_t * p; wchar_t * p;
int rc = 0; int rc = 0;
size_t plen; size_t plen;
size_t slen;
INSTALLED_PYTHON * ip; INSTALLED_PYTHON * ip;
BOOL valid; BOOL valid;
DWORD size, attrs; DWORD size, attrs;
@ -1602,10 +1601,11 @@ process(int argc, wchar_t ** argv)
else { else {
p = argv[1]; p = argv[1];
plen = wcslen(p); plen = wcslen(p);
if (argc == 2) { if ((argc == 2) &&
slen = wcslen(L"-0"); (!wcsncmp(p, L"-0", wcslen(L"-0")) || /* Starts with -0 or --list */
if(!wcsncmp(p, L"-0", slen)) /* Starts with -0 */ !wcsncmp(p, L"--list", wcslen(L"--list"))))
valid = show_python_list(argv); /* Check for -0 FIRST */ {
valid = show_python_list(argv); /* Check for -0 or --list FIRST */
} }
valid = valid && (*p == L'-') && validate_version(&p[1]); valid = valid && (*p == L'-') && validate_version(&p[1]);
if (valid) { if (valid) {
@ -1638,10 +1638,13 @@ installed, use -0 for available pythons", &p[1]);
if (!valid) { if (!valid) {
if ((argc == 2) && (!_wcsicmp(p, L"-h") || !_wcsicmp(p, L"--help"))) if ((argc == 2) && (!_wcsicmp(p, L"-h") || !_wcsicmp(p, L"--help")))
show_help_text(argv); show_help_text(argv);
if ((argc == 2) && (!_wcsicmp(p, L"-0") || !_wcsicmp(p, L"-0p"))) if ((argc == 2) &&
executable = NULL; /* Info call only */ (!_wcsicmp(p, L"-0") || !_wcsicmp(p, L"--list") ||
else !_wcsicmp(p, L"-0p") || !_wcsicmp(p, L"--list-paths")))
{ {
executable = NULL; /* Info call only */
}
else {
/* Look for an active virtualenv */ /* Look for an active virtualenv */
executable = find_python_by_venv(); executable = find_python_by_venv();