File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,13 @@ def is_native(package_name: str) -> bool:
2020 """
2121 Returns whether a package is native or not.
2222 """
23+ import platform
24+
25+ # Skip platform-specific modules on incompatible platforms
26+ if (package_name == "scalene.scalene_apple_gpu" and
27+ platform .system () != "Darwin" ):
28+ return False
29+
2330 result = False
2431 try :
2532 package = importlib .import_module (package_name )
@@ -41,6 +48,9 @@ def is_native(package_name: str) -> bool:
4148 except TypeError :
4249 # __file__ is there, but empty (os.path.dirname() returns TypeError). Let's call it native.
4350 result = True
51+ except OSError :
52+ # Platform-specific import failed (e.g., missing system libraries)
53+ result = False
4454 return result
4555
4656 @staticmethod
You can’t perform that action at this time.
0 commit comments