-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
executable file
·37 lines (25 loc) · 819 Bytes
/
build.py
File metadata and controls
executable file
·37 lines (25 loc) · 819 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
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3
import os, os.path
import shutil
import subprocess
SROOT = 'src'
DROOT = 'dist'
def main():
# setup
if not os.path.exists(DROOT):
os.mkdir(DROOT)
if os.path.exists(os.path.join(SROOT, '__javascript__')):
shutil.rmtree(os.path.join(SROOT, '__javascript__'))
# transpile src/
run('transcrypt -b -m --parent=.none src/main.py')
shutil.copy(os.path.join(SROOT, '__javascript__', 'main.min.js'), os.path.join(DROOT, 'main.min.js'))
shutil.copy(os.path.join(SROOT, '__javascript__', 'main.js'), os.path.join(DROOT, 'main.js'))
#########################
### Helper functions
def run(cmd):
print('\t' + cmd)
subprocess.run(cmd, shell=True, check=True)
#########################
### Start the program
if __name__ == '__main__':
main()