Skip to content

Commit 86a01bd

Browse files
committed
more targeted regex for export matching
1 parent 65ab7d1 commit 86a01bd

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

webgpu/link/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
import re
12
from pathlib import Path
23

3-
js_code = (Path(__file__).parent / "link.js").read_text().replace("export ", "")
4+
_link_js_path = Path(__file__).parent / "link.js"
5+
if not _link_js_path.exists():
6+
raise FileNotFoundError(
7+
f"webgpu link.js not found at {_link_js_path}. "
8+
"The webgpu package may be installed incorrectly."
9+
)
10+
11+
js_code = re.sub(r"^export ", "", _link_js_path.read_text(), flags=re.MULTILINE)

0 commit comments

Comments
 (0)