-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathhatch_build.py
More file actions
28 lines (21 loc) · 866 Bytes
/
Copy pathhatch_build.py
File metadata and controls
28 lines (21 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import sys
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
class CustomHook(BuildHookInterface):
def initialize(self, version, build_data):
if self.target_name not in {"wheel", "install"}:
return
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
try:
from compiler.api.compiler import start as compile_api
from compiler.errors.compiler import start as compile_errors
except ImportError as e:
raise RuntimeError("Could not import compiler.") from e
try:
compile_api()
except Exception as e:
raise RuntimeError("Could not compile compiler.") from e
try:
compile_errors()
except Exception as e:
raise RuntimeError("Could not compile errors.") from e