Skip to content

Commit 936ce75

Browse files
Copilotemeryberger
andcommitted
Fix CI smoke tests by adding platform check for Apple GPU module
Co-authored-by: emeryberger <1612723+emeryberger@users.noreply.github.com>
1 parent 79c26ab commit 936ce75

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scalene/scalene_analysis.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)