@@ -321,22 +321,31 @@ def write_config(config: Dict[str, str]):
321321def get_tracked_release (
322322 tracked_release : Path , rhel_suffix : Optional [str ] = None
323323) -> Path :
324- abs_path = Path (tracked_release ).resolve ()
325-
326- if (abs_path / "root" ).is_dir ():
327- return abs_path
328-
329- custom_coordinate = find_custom_coordinate (tracked_release )
330-
331324 if not rhel_suffix :
332325 rhel_suffix = rhel_version_suffix ()
333326
334- tracked_release = Path (str (tracked_release ) + rhel_suffix ).resolve ()
335-
336- if (tracked_release / "root" ).is_dir ():
337- return tracked_release
338-
339- return Path (str (tracked_release ) + custom_coordinate ).resolve ()
327+ custom_coordinate = find_custom_coordinate (tracked_release )
328+ detected_python_version = ""
329+ parts = Path (tracked_release ).name .split ("-" )
330+ abs_path = Path (tracked_release ).parent
331+ base_release = f"{ abs_path } /{ parts [0 ]} "
332+ for p in parts :
333+ if re .match (r"^(?:\d{8}|\d{4})$" , p ):
334+ base_release += f"-{ p } "
335+ elif p .startswith ("py" ):
336+ detected_python_version = f"-{ p } "
337+
338+ for rp in [
339+ f"{ base_release } { detected_python_version } { rhel_suffix } { custom_coordinate } " ,
340+ f"{ base_release } { detected_python_version } { rhel_suffix } " ,
341+ f"{ base_release } { detected_python_version } { custom_coordinate } " ,
342+ f"{ base_release } { detected_python_version } " ,
343+ ]:
344+ possible_root_release = Path (rp ).resolve ()
345+ if (possible_root_release / "root" ).is_dir ():
346+ return possible_root_release
347+
348+ return Path ()
340349
341350
342351def find_custom_coordinate (release_path : Path ) -> str :
0 commit comments