@@ -81,6 +81,10 @@ def host_interpreter_minor_version() -> int:
8181 return sys .version_info .minor
8282
8383
84+ def host_interpreter_micro_version () -> int :
85+ return sys .version_info .micro
86+
87+
8488@dataclass (frozen = True )
8589class Platform :
8690 os : Optional [OS ] = None
@@ -281,6 +285,13 @@ def platform_machine(self) -> str:
281285 def env_markers (self , extra : str ) -> Dict [str , str ]:
282286 # If it is None, use the host version
283287 minor_version = self .minor_version or host_interpreter_minor_version ()
288+ # NOTE: We use the `micro_version` from the current interpreter, which
289+ # currently works around
290+ # https://github.com/bazelbuild/rules_python/issues/2319
291+ #
292+ # If we wanted to pass it to this function then we would have a combinatorial
293+ # explosion.
294+ micro_version = host_interpreter_micro_version ()
284295
285296 return {
286297 "extra" : extra ,
@@ -291,11 +302,8 @@ def env_markers(self, extra: str) -> Dict[str, str]:
291302 "platform_release" : "" , # unset
292303 "platform_version" : "" , # unset
293304 "python_version" : f"3.{ minor_version } " ,
294- # FIXME @aignas 2024-01-14: is putting zero last a good idea? Maybe we should
295- # use `20` or something else to avoid having weird issues where the full version is used for
296- # matching and the author decides to only support 3.y.5 upwards.
297- "implementation_version" : f"3.{ minor_version } .0" ,
298- "python_full_version" : f"3.{ minor_version } .0" ,
305+ "implementation_version" : f"3.{ minor_version } .{ micro_version } " ,
306+ "python_full_version" : f"3.{ minor_version } .{ micro_version } " ,
299307 # we assume that the following are the same as the interpreter used to setup the deps:
300308 # "implementation_name": "cpython"
301309 # "platform_python_implementation: "CPython",
0 commit comments