--- development-support/_common_definitions.py.orig	2026-04-06 10:07:40
+++ development-support/_common_definitions.py	2026-04-06 10:08:12
@@ -7,6 +7,7 @@
 
 import contextlib
 import os
+import platform
 import shutil
 import subprocess
 import time
@@ -48,6 +49,13 @@
     RESET = ""
 
 _detected_versions = None
+
+cur_platform = platform.mac_ver()[0].rsplit('.', 1)[0]
+
+def version_key(version: str) -> tuple[int, ...]:
+    if version is None:
+        return None
+    return tuple(int(x) for x in version.split("."))
 
 
 def is_usable_release(ver: str, *, include_alpha: bool = False) -> bool:
@@ -269,8 +277,15 @@
             continue
 
         setup = os.path.join(TOP_DIR, subdir, "setup.py")
+
+        if not os.path.exists(setup):
+            print(f"Skipping {subdir} because it has no setup.py script")
+            continue
 
         requires = None
+        min_platform = None
+        max_platform = None
+
         with open(setup) as fp:
             for ln in fp:
                 if requires is None:
@@ -295,8 +310,27 @@
                         dep = dep.split(">")[0]
                         requires.append(dep)
 
-        frameworks.append(subdir)
-        for dep in requires:
-            partial_order.append((dep, subdir))
+                if ln.strip().startswith("min_os_level"):
+                    min_platform = ln.strip().split("=")[-1]
+                    if min_platform.endswith(","):
+                        min_platform = min_platform[:-1]
+                    min_platform = min_platform[1:-1]
 
+                if ln.strip().startswith("max_os_level"):
+                    max_platform = ln.strip().split("=")[-1]
+                    if max_platform.endswith(","):
+                        max_platform = max_platform[:-1]
+                    max_platform = max_platform[1:-1]
+
+            if min_platform and not (version_key(min_platform) <= version_key(cur_platform)):
+                print(f"Skipping {subdir} because it is not supported on the current platform")
+                print(f"cur={version_key(cur_platform)}, min={version_key(min_platform)}, max={version_key(max_platform)}")
+            elif max_platform and not (version_key(max_platform) >= version_key(cur_platform)):
+                print(f"Skipping {subdir} because it is not supported on the current platform")
+                print(f"cur={version_key(cur_platform)}, min={version_key(min_platform)}, max={version_key(max_platform)}")
+            else:
+                frameworks.append(subdir)
+                for dep in requires:
+                    partial_order.append((dep, subdir))
+
     return topological_sort(frameworks, partial_order)
