blob: fde52275eff6d19c347ddf46a1430d8e4f40dc01 (
plain)
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
|
import os
base_path = os.path.dirname(__file__)
dst_config = os.path.join(base_path, 'lv_conf.h')
src_config = os.path.abspath(os.path.join(
base_path,
'..',
'lv_conf_template.h'
))
def run(c_path=None):
global dst_config
if c_path is not None:
dst_config = c_path
with open(src_config, 'r') as f:
data = f.read()
data = data.split('\n')
for i, line in enumerate(data):
if 'LV_USE_PROFILER' in line:
continue
if 'LV_USE' in line or 'LV_FONT' in line and '#define' in line:
line = [item for item in line.split(' ') if item]
for j, item in enumerate(line):
if item == '0':
line[j] = '1'
line = ' '.join(line)
data[i] = line
elif line.startswith('#if 0'):
line = line.replace('#if 0', '#if 1')
data[i] = line
data = '\n'.join(data)
with open(dst_config, 'w') as f:
f.write(data)
def cleanup():
if os.path.exists(dst_config):
os.remove(dst_config)
|