forked from bigtreetech/BIGTREETECH-TouchScreenFirmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
65 lines (45 loc) · 1.42 KB
/
setup.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python
#
# setup scons build
#
# https://github.com/SCons/scons/blob/master/src/engine/SCons/Environment.py
import os
import subprocess
import SCons
from SCons.Script import Import
from SCons.Script import AlwaysBuild
Import("env")
def report_args(*args, **kwargs):
for entry in args:
print(f"{entry}")
for key, value in sorted(kwargs.items()):
print(f"{key}={value}")
def report_env_var():
for key, value in sorted(os.environ.items()):
print(f"{key}={value}")
def report_dir_list(root):
for path in sorted(os.listdir(root)):
print(path)
# def setup_invoke(
# env,
# source:SCons.Node.FS.File,
# target:SCons.Node.Alias.Alias):
# firmware = source[0].abspath
# print(f"### firmware={firmware}")
# disk_name = disk_find()
# print(f"### disk_name={disk_name}")
# disk_setup(disk_name, firmware)
print('====================================')
print('extra_script')
print('------------------------------------')
# print(env.Dump())
root_dir = env['PROJECT_DIR']
this_dir = f"{root_dir}/buildroot/user"
setup_disk = f"{this_dir}/setup_disk.py"
config_path = f"{root_dir}/DISK/config.ini"
setup_target = env.Alias("setup",
"${BUILD_DIR}/${PROGNAME}.bin",
f"{setup_disk} --config_path={config_path} --firmware_path=$SOURCE.abspath"
)
env.AlwaysBuild(setup_target)
print('====================================')