Skip to content

Commit d9c7483

Browse files
meng-plusmysterywolf
authored andcommitted
fix: 更换去重算法,保证工程输出一致性
便于 git管理
1 parent c39e92f commit d9c7483

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

tools/building.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,8 @@ def DefineGroup(name, src, depend, **parameters):
579579
group['name'] = name
580580
group['path'] = group_path
581581
if type(src) == type([]):
582-
# remove duplicate elements from list
583-
src = list(set(src))
582+
# remove duplicate elements from list while preserving order
583+
src = list(dict.fromkeys(src))
584584
group['src'] = File(src)
585585
else:
586586
group['src'] = src

tools/targets/iar.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,11 @@ def searchLib(group):
131131
print('not found LIB: ' + item)
132132

133133
# make relative path
134-
paths = set()
134+
paths = {}
135135
for path in CPPPATH:
136136
inc = _make_path_relative(project_path, os.path.normpath(path))
137-
paths.add(inc) #.replace('\\', '/')
137+
paths[inc] = None # 使用 dict 去重并保持插入顺序
138+
paths = list(paths.keys())
138139

139140
# setting options
140141
options = tree.findall('configuration/settings/data/option')

0 commit comments

Comments
 (0)