mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-08-29 17:16:07 +00:00
minor WEBGPU_PATH cleanup [pr] (#9552)
also mypy recognizes `sys.platform == 'win32'` but does not recognizes it if wrapped inside a helper...
This commit is contained in:
@@ -9,9 +9,8 @@ if sys.platform == 'win32':
|
||||
raise FileNotFoundError('LLVM not found, you can install it with `winget install LLVM.LLVM` or point at a custom dll with LLVM_PATH')
|
||||
elif OSX:
|
||||
# Will raise FileNotFoundError if brew is not installed
|
||||
brew_prefix = subprocess.check_output(['brew', '--prefix', 'llvm']).decode().strip()
|
||||
# `brew --prefix` will return even if formula is not installed
|
||||
if not os.path.exists(brew_prefix):
|
||||
if not os.path.exists(brew_prefix:=subprocess.check_output(['brew', '--prefix', 'llvm']).decode().strip()):
|
||||
raise FileNotFoundError('LLVM not found, you can install it with `brew install llvm`')
|
||||
LLVM_PATH: str|None = os.path.join(brew_prefix, 'lib', 'libLLVM.dylib')
|
||||
else:
|
||||
|
||||
@@ -2,14 +2,10 @@ import ctypes, ctypes.util, os, subprocess
|
||||
from tinygrad.helpers import OSX
|
||||
|
||||
if OSX:
|
||||
brew_prefix = subprocess.check_output(['brew', '--prefix', 'dawn']).decode().strip()
|
||||
|
||||
if not os.path.exists(brew_prefix):
|
||||
if not os.path.exists(brew_prefix:=subprocess.check_output(['brew', '--prefix', 'dawn']).decode().strip()):
|
||||
raise FileNotFoundError('dawn library not found. Install it with `brew tap wpmed92/dawn && brew install dawn`')
|
||||
WEBGPU_PATH: str|None = os.path.join(brew_prefix, 'lib', 'libwebgpu_dawn.dylib')
|
||||
else:
|
||||
WEBGPU_PATH = ctypes.util.find_library('webgpu_dawn')
|
||||
|
||||
if WEBGPU_PATH is None:
|
||||
if (WEBGPU_PATH:=ctypes.util.find_library('webgpu_dawn')) is None:
|
||||
raise FileNotFoundError("dawn library not found. " +
|
||||
"Install it with `sudo curl -L https://github.com/wpmed92/pydawn/releases/download/v0.1.6/libwebgpu_dawn.so -o /usr/lib/libwebgpu_dawn.so`")
|
||||
|
||||
Reference in New Issue
Block a user