-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
hatch_build.py
37 lines (28 loc) · 834 Bytes
/
hatch_build.py
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
29
30
31
32
33
34
35
36
37
import glob
import os
from subprocess import check_call
import shutil
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
here = os.path.abspath(os.path.dirname(__file__))
def build_javascript():
check_call(
['yarn', 'install'],
cwd=here,
)
check_call(
['yarn', 'build:webpack', '--mode=production'],
cwd=here,
)
for file in glob.glob(r'./dist/*.js'):
shutil.copy(
file,
'./jupyter_manager/static/'
)
class JupyterBuildHook(BuildHookInterface):
def initialize(self, version, build_data):
if self.target_name == 'editable':
build_javascript()
elif self.target_name == 'wheel':
build_javascript()
elif self.target_name == 'sdist':
build_javascript()