@@ -108,9 +108,9 @@ def extract_base_python(env_name: str) -> str | None:
108
108
candidates : list [str ] = []
109
109
for factor in env_name .split ("-" ):
110
110
spec = PythonSpec .from_string_spec (factor )
111
- if spec .implementation is not None :
112
- if spec . implementation . lower () in INTERPRETER_SHORT_NAMES and env_name is not None :
113
- candidates .append (factor )
111
+ impl = spec .implementation or "python"
112
+ if impl . lower () in INTERPRETER_SHORT_NAMES and env_name is not None and spec . path is None :
113
+ candidates .append (factor )
114
114
if candidates :
115
115
if len (candidates ) > 1 :
116
116
raise ValueError (f"conflicting factors { ', ' .join (candidates )} in { env_name } " )
@@ -123,18 +123,19 @@ def _validate_base_python(env_name: str, base_pythons: list[str], ignore_base_py
123
123
elements .update (env_name .split ("-" )) # and also any factor
124
124
for candidate in elements :
125
125
spec_name = PythonSpec .from_string_spec (candidate )
126
- if spec_name .implementation is not None and spec_name .implementation .lower () in ("pypy" , "cpython" ):
127
- for base_python in base_pythons :
128
- spec_base = PythonSpec .from_string_spec (base_python )
129
- if any (
130
- getattr (spec_base , key ) != getattr (spec_name , key )
131
- for key in ("implementation" , "major" , "minor" , "micro" , "architecture" )
132
- if getattr (spec_base , key ) is not None and getattr (spec_name , key ) is not None
133
- ):
134
- msg = f"env name { env_name } conflicting with base python { base_python } "
135
- if ignore_base_python_conflict :
136
- return [env_name ] # ignore the base python settings
137
- raise Fail (msg )
126
+ if spec_name .implementation and spec_name .implementation .lower () not in INTERPRETER_SHORT_NAMES :
127
+ continue
128
+ for base_python in base_pythons :
129
+ spec_base = PythonSpec .from_string_spec (base_python )
130
+ if any (
131
+ getattr (spec_base , key ) != getattr (spec_name , key )
132
+ for key in ("implementation" , "major" , "minor" , "micro" , "architecture" )
133
+ if getattr (spec_base , key ) is not None and getattr (spec_name , key ) is not None
134
+ ):
135
+ msg = f"env name { env_name } conflicting with base python { base_python } "
136
+ if ignore_base_python_conflict :
137
+ return [env_name ] # ignore the base python settings
138
+ raise Fail (msg )
138
139
return base_pythons
139
140
140
141
@abstractmethod
0 commit comments