You've already forked macports-ports
mirror of
https://github.com/macports/macports-ports.git
synced 2026-03-31 14:42:53 -07:00
91 lines
3.2 KiB
Diff
91 lines
3.2 KiB
Diff
--- development-support/_common_definitions.py.orig 2026-03-24 12:34:08
|
|
+++ development-support/_common_definitions.py 2026-03-24 12:33:46
|
|
@@ -7,6 +7,7 @@
|
|
|
|
import contextlib
|
|
import os
|
|
+import platform
|
|
import shutil
|
|
import subprocess
|
|
import time
|
|
@@ -49,7 +50,15 @@
|
|
|
|
_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:
|
|
if ver.endswith("t"):
|
|
path = os.path.join("/Library/Frameworks/PythonT.framework/Versions", ver[:-1])
|
|
@@ -263,6 +272,10 @@
|
|
"""
|
|
frameworks = []
|
|
partial_order = []
|
|
+
|
|
+ # FIXME
|
|
+ subprocess.run(["echo", f"Content of TOP_DIR {TOP_DIR}:"])
|
|
+ subprocess.run(["ls", "-l", TOP_DIR])
|
|
|
|
for subdir in os.listdir(TOP_DIR):
|
|
if not subdir.startswith("pyobjc-framework-"):
|
|
@@ -270,7 +283,18 @@
|
|
|
|
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
|
|
+
|
|
+ # FIXME
|
|
+ subprocess.run(["echo", "Content of subdir ", os.path.join(TOP_DIR, subdir), ":"])
|
|
+ subprocess.run(["ls", "-l", os.path.join(TOP_DIR, subdir)])
|
|
+
|
|
with open(setup) as fp:
|
|
for ln in fp:
|
|
if requires is None:
|
|
@@ -295,8 +319,30 @@
|
|
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]
|
|
+ # FIXME
|
|
+ print(f"{subdir}: min={version_key(min_platform)}, max={version_key(max_platform)}, cur={version_key(cur_platform)}")
|
|
+
|
|
+ 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")
|
|
+ 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")
|
|
+ else:
|
|
+ frameworks.append(subdir)
|
|
+ for dep in requires:
|
|
+ partial_order.append((dep, subdir))
|
|
+
|
|
+ # FIXME
|
|
+ print(f"FRAMEWORKS: {topological_sort(frameworks, partial_order)}")
|
|
+
|
|
return topological_sort(frameworks, partial_order)
|