@@ -1454,7 +1454,7 @@ show_python_list(wchar_t ** argv)
1454
1454
fwprintf (stderr , L"\n\nCan't find a Default Python.\n\n" );
1455
1455
else
1456
1456
fwprintf (stderr , L"\n\n" ); /* End with a blank line */
1457
- return ( FALSE) ; /* If this has been called we cannot continue */
1457
+ return FALSE; /* If this has been called we cannot continue */
1458
1458
}
1459
1459
1460
1460
static int
@@ -1468,7 +1468,6 @@ process(int argc, wchar_t ** argv)
1468
1468
size_t plen ;
1469
1469
INSTALLED_PYTHON * ip ;
1470
1470
BOOL valid ;
1471
- BOOL version_call = FALSE;
1472
1471
DWORD size , attrs ;
1473
1472
HRESULT hr ;
1474
1473
wchar_t message [MSGSIZE ];
@@ -1601,15 +1600,15 @@ process(int argc, wchar_t ** argv)
1601
1600
}
1602
1601
else {
1603
1602
p = argv [1 ];
1604
- if ((argc == 2 ) &&
1605
- (!_wcsicmp (p , L"-0" ) || !_wcsicmp (p , L"--list" ) || /* Version args. */
1606
- !_wcsicmp (p , L"-0p" ) || !_wcsicmp (p , L"--list-paths" )))
1603
+ plen = wcslen (p );
1604
+ if ((argc == 2 ) && // list version args
1605
+ (!wcsncmp (p , L"-0" , wcslen (L"-0" )) ||
1606
+ !wcsncmp (p , L"--list" , wcslen (L"--list" ))))
1607
1607
{
1608
1608
show_python_list (argv );
1609
- version_call = TRUE;
1610
- executable = NULL ;
1609
+ return rc ;
1611
1610
}
1612
- valid = ! version_call && (* p == L'-' ) && validate_version (& p [1 ]);
1611
+ valid = valid && (* p == L'-' ) && validate_version (& p [1 ]);
1613
1612
if (valid ) {
1614
1613
ip = locate_python (& p [1 ], FALSE);
1615
1614
if (ip == NULL )
@@ -1640,25 +1639,29 @@ installed, use -0 for available pythons", &p[1]);
1640
1639
if (!valid ) {
1641
1640
if ((argc == 2 ) && (!_wcsicmp (p , L"-h" ) || !_wcsicmp (p , L"--help" )))
1642
1641
show_help_text (argv );
1643
-
1644
- /* Look for an active virtualenv */
1645
- executable = find_python_by_venv ();
1646
-
1647
- /* If we didn't find one, look for the default Python */
1648
- if (executable == NULL ) {
1649
- ip = locate_python (L"" , FALSE);
1650
- if (ip == NULL )
1651
- error (RC_NO_PYTHON , L"Can't find a default Python." );
1652
- executable = ip -> executable ;
1642
+ if ((argc == 2 ) &&
1643
+ (!_wcsicmp (p , L"-0" ) || !_wcsicmp (p , L"--list" ) ||
1644
+ !_wcsicmp (p , L"-0p" ) || !_wcsicmp (p , L"--list-paths" )))
1645
+ {
1646
+ executable = NULL ; /* Info call only */
1647
+ }
1648
+ else {
1649
+ /* Look for an active virtualenv */
1650
+ executable = find_python_by_venv ();
1651
+
1652
+ /* If we didn't find one, look for the default Python */
1653
+ if (executable == NULL ) {
1654
+ ip = locate_python (L"" , FALSE);
1655
+ if (ip == NULL )
1656
+ error (RC_NO_PYTHON , L"Can't find a default Python." );
1657
+ executable = ip -> executable ;
1658
+ }
1653
1659
}
1654
1660
}
1655
- if (executable == NULL ) {
1656
- rc = RC_NO_PYTHON ;
1657
- }
1658
- else if (!version_call ) {
1661
+ if (executable != NULL )
1659
1662
invoke_child (executable , NULL , command );
1660
- }
1661
-
1663
+ else
1664
+ rc = RC_NO_PYTHON ;
1662
1665
return rc ;
1663
1666
}
1664
1667
0 commit comments