MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / bsp_update_kconfig_library

Function bsp_update_kconfig_library

tools/mkdist.py:137–160  ·  view source on GitHub ↗
(dist_dir)

Source from the content-addressed store, hash-verified

135 f.write(line)
136
137def bsp_update_kconfig_library(dist_dir):
138 # change RTT_ROOT in Kconfig
139 if not os.path.isfile(os.path.join(dist_dir, 'Kconfig')):
140 return
141
142 with open(os.path.join(dist_dir, 'Kconfig'), 'r') as f:
143 data = f.readlines()
144 with open(os.path.join(dist_dir, 'Kconfig'), 'w') as f:
145 for line in data:
146 if line.find('source') != -1 and line.find('../libraries') != -1:
147 line = line.replace('../libraries', 'libraries')
148 f.write(line)
149
150 # change board/kconfig path
151 if not os.path.isfile(os.path.join(dist_dir, 'board/Kconfig')):
152 return
153
154 with open(os.path.join(dist_dir, 'board/Kconfig'), 'r') as f:
155 data = f.readlines()
156 with open(os.path.join(dist_dir, 'board/Kconfig'), 'w') as f:
157 for line in data:
158 if line.find('source') != -1 and line.find('../libraries') != -1:
159 line = line.replace('../libraries', 'libraries')
160 f.write(line)
161
162def zip_dist(dist_dir, dist_name):
163 import zipfile

Callers 1

MkDistFunction · 0.70

Calls 3

openFunction · 0.50
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected