@@ -393,12 +393,6 @@ typedef struct {
393
393
// only currently possible high priority environment is an active virtual
394
394
// environment
395
395
bool lowPriorityTag ;
396
- // if true, we had an old-style tag with '-64' suffix, and so do not
397
- // want to match tags like '3.x-32'
398
- bool exclude32Bit ;
399
- // if true, we had an old-style tag with '-32' suffix, and so *only*
400
- // want to match tags like '3.x-32'
401
- bool only32Bit ;
402
396
// if true, allow PEP 514 lookup to override 'executable'
403
397
bool allowExecutableOverride ;
404
398
// if true, allow a nearby pyvenv.cfg to locate the executable
@@ -483,8 +477,6 @@ dumpSearchInfo(SearchInfo *search)
483
477
DEBUG_2 (tag , tagLength );
484
478
DEBUG_BOOL (oldStyleTag );
485
479
DEBUG_BOOL (lowPriorityTag );
486
- DEBUG_BOOL (exclude32Bit );
487
- DEBUG_BOOL (only32Bit );
488
480
DEBUG_BOOL (allowDefaults );
489
481
DEBUG_BOOL (allowExecutableOverride );
490
482
DEBUG_BOOL (windowed );
@@ -649,17 +641,6 @@ parseCommandLine(SearchInfo *search)
649
641
search -> tagLength = argLen ;
650
642
search -> oldStyleTag = true;
651
643
search -> restOfCmdLine = tail ;
652
- // If the tag ends with -64, we want to exclude 32-bit runtimes
653
- // (If the tag ends with -32, it will be filtered later)
654
- if (argLen > 3 ) {
655
- if (0 == _compareArgument (& arg [argLen - 3 ], 3 , L"-64" , 3 )) {
656
- search -> tagLength -= 3 ;
657
- search -> exclude32Bit = true;
658
- } else if (0 == _compareArgument (& arg [argLen - 3 ], 3 , L"-32" , 3 )) {
659
- search -> tagLength -= 3 ;
660
- search -> only32Bit = true;
661
- }
662
- }
663
644
} else if (STARTSWITH (L"V:" ) || STARTSWITH (L"-version:" )) {
664
645
// Arguments starting with 'V:' specify company and/or tag
665
646
const wchar_t * argStart = wcschr (arg , L':' ) + 1 ;
@@ -1087,6 +1068,7 @@ checkDefaults(SearchInfo *search)
1087
1068
if (!slash ) {
1088
1069
search -> tag = tag ;
1089
1070
search -> tagLength = n ;
1071
+ search -> oldStyleTag = true;
1090
1072
} else {
1091
1073
search -> company = tag ;
1092
1074
search -> companyLength = (int )(slash - tag );
@@ -1966,10 +1948,25 @@ _selectEnvironment(const SearchInfo *search, EnvironmentInfo *env, EnvironmentIn
1966
1948
}
1967
1949
} else if (0 == _compare (env -> company , -1 , L"PythonCore" , -1 )) {
1968
1950
// Old-style tags can only match PythonCore entries
1969
- if (_startsWith (env -> tag , -1 , search -> tag , search -> tagLength )) {
1970
- if (search -> exclude32Bit && _is32Bit (env )) {
1951
+
1952
+ // If the tag ends with -64, we want to exclude 32-bit runtimes
1953
+ // (If the tag ends with -32, it will be filtered later)
1954
+ int tagLength = search -> tagLength ;
1955
+ bool exclude32Bit = false, only32Bit = false;
1956
+ if (tagLength > 3 ) {
1957
+ if (0 == _compareArgument (& search -> tag [tagLength - 3 ], 3 , L"-64" , 3 )) {
1958
+ tagLength -= 3 ;
1959
+ exclude32Bit = true;
1960
+ } else if (0 == _compareArgument (& search -> tag [tagLength - 3 ], 3 , L"-32" , 3 )) {
1961
+ tagLength -= 3 ;
1962
+ only32Bit = true;
1963
+ }
1964
+ }
1965
+
1966
+ if (_startsWith (env -> tag , -1 , search -> tag , tagLength )) {
1967
+ if (exclude32Bit && _is32Bit (env )) {
1971
1968
debug (L"# Excluding %s/%s because it looks like 32bit\n" , env -> company , env -> tag );
1972
- } else if (search -> only32Bit && !_is32Bit (env )) {
1969
+ } else if (only32Bit && !_is32Bit (env )) {
1973
1970
debug (L"# Excluding %s/%s because it doesn't look 32bit\n" , env -> company , env -> tag );
1974
1971
} else {
1975
1972
* best = env ;
0 commit comments