@@ -2033,13 +2033,16 @@ def aggregate_dir():
2033
2033
variant_exp = []
2034
2034
# Compare the first directory to all other directories
2035
2035
while mcu_dirs and index < len (mcu_dirs ):
2036
- # Compare all the variant file except the generic_boards.txt
2036
+ # Compare all the variant files except the generic_boards.txt
2037
2037
mcu_dir2_files_list = [
2038
2038
mcu_dirs [index ] / periph_c_filename ,
2039
2039
mcu_dirs [index ] / pinvar_h_filename ,
2040
2040
mcu_dirs [index ] / variant_cpp_filename ,
2041
2041
mcu_dirs [index ] / variant_h_filename ,
2042
2042
]
2043
+ # Iterate over each variant files
2044
+ periph_xml_tmp = []
2045
+ variant_exp_tmp = []
2043
2046
for index2 , fname in enumerate (mcu_dir1_files_list ):
2044
2047
with open (fname , "r" ) as f1 :
2045
2048
with open (mcu_dir2_files_list [index2 ], "r" ) as f2 :
@@ -2048,20 +2051,30 @@ def aggregate_dir():
2048
2051
if not diff or len (diff ) == 2 :
2049
2052
if index2 == 0 :
2050
2053
for line in diff :
2051
- periph_xml += periperalpins_regex .findall (line )
2054
+ periph_xml_tmp += periperalpins_regex .findall (
2055
+ line
2056
+ )
2052
2057
elif index2 == 2 :
2053
2058
for line in diff :
2054
- variant_exp += variant_regex .findall (line )
2059
+ variant_exp_tmp += variant_regex .findall (line )
2055
2060
continue
2056
2061
else :
2057
2062
# Not the same directory compare with the next one
2058
2063
index += 1
2059
2064
break
2060
2065
# All files compared and matched
2061
2066
else :
2067
+ # Concatenate lists without duplicate
2068
+ uniq_periph_xml = set (periph_xml_tmp ) - set (periph_xml )
2069
+ periph_xml = periph_xml + list (uniq_periph_xml )
2070
+ uniq_variant_exp = set (variant_exp_tmp ) - set (variant_exp )
2071
+ variant_exp = variant_exp + list (uniq_variant_exp )
2062
2072
# Matched files append to the group list
2063
2073
group_mcu_dir .append (mcu_dirs .pop (index ))
2074
+ del periph_xml_tmp [:]
2075
+ del variant_exp_tmp [:]
2064
2076
del mcu_dir2_files_list [:]
2077
+
2065
2078
# Merge directories name and contents if needed
2066
2079
mcu_dir = merge_dir (
2067
2080
out_temp_path , group_mcu_dir , mcu_family , periph_xml , variant_exp
0 commit comments