File tree 3 files changed +576
-0
lines changed
3 files changed +576
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ astyle.out
3
3
boards.local.txt
4
4
platform.local.txt
5
5
path_config.json
6
+ update_config.json
6
7
7
8
# Backup
8
9
* .bak
Original file line number Diff line number Diff line change
1
+ import os
2
+ import re
3
+ import shutil
4
+
5
+
6
+ # Create a folder if not exists
7
+ def createFolder (path ):
8
+ try :
9
+ if not os .path .exists (path ):
10
+ os .makedirs (path )
11
+ except OSError :
12
+ print ("Error: Creating directory. " + path )
13
+
14
+
15
+ # Delete targeted folder recursively
16
+ def deleteFolder (path ):
17
+ if os .path .isdir (path ):
18
+ shutil .rmtree (path , ignore_errors = True )
19
+
20
+
21
+ # copy src folder recursively to dest
22
+ def copyFolder (src , dest , ign_patt = set ()):
23
+ try :
24
+ if os .path .isdir (src ):
25
+ shutil .copytree (src , dest , ignore = shutil .ignore_patterns (* ign_patt ))
26
+ except OSError as e :
27
+ print ("Error: Folder %s not copied. %s" % src , e )
28
+
29
+
30
+ def genSTM32List (path , pattern ):
31
+ stm32_list = [] # Serie
32
+ dir_pattern = re .compile ("^STM32(.*)xx_HAL_Driver$" , re .IGNORECASE )
33
+
34
+ if pattern is not None :
35
+ serie_pattern = re .compile (pattern , re .IGNORECASE )
36
+ else :
37
+ serie_pattern = re .compile (".*" , re .IGNORECASE )
38
+
39
+ for file in os .listdir (path ):
40
+ res = dir_pattern .match (file )
41
+ if res and serie_pattern .search (res .group (1 )):
42
+ stm32_list .append (res .group (1 ))
43
+ stm32_list .sort ()
44
+ return stm32_list
You can’t perform that action at this time.
0 commit comments