1
1
import sys
2
2
import subprocess
3
3
from pathlib import Path
4
+ from multiprocessing import Pool
4
5
5
- # path, url, commit
6
+ # path, url, commit (Alphabet sorted by path)
6
7
deps_list = {
7
8
'hw/mcu/allwinner' : [ 'https://github.com/hathach/allwinner_driver.git' , '8e5e89e8e132c0fd90e72d5422e5d3d68232b756' ],
8
9
'hw/mcu/bridgetek/ft9xx/ft90x-sdk' : [ 'https://github.com/BRTSG-FOSS/ft90x-sdk.git' , '91060164afe239fcb394122e8bf9eb24d3194eb1' ],
53
54
'hw/mcu/ti' : [ 'https://github.com/hathach/ti_driver.git' , '143ed6cc20a7615d042b03b21e070197d473e6e5' ],
54
55
'hw/mcu/wch/ch32v307' : [ 'https://github.com/openwch/ch32v307.git' , '17761f5cf9dbbf2dcf665b7c04934188add20082' ],
55
56
'lib/CMSIS_5' : [ 'https://github.com/ARM-software/CMSIS_5.git' , '20285262657d1b482d132d20d755c8c330d55c1f' ],
56
- 'lib/FreeRTOS-Kernel' : [ 'https://github.com/FreeRTOS/FreeRTOS-Kernel.git' , '2a604f4a2818b8354b5e1a39e388eb5e16cfbc1f' ],
57
- 'lib/lwip' : [ 'https://github.com/lwip-tcpip/lwip.git' , '159e31b689577dbf69cf0683bbaffbd71fa5ee10' ],
57
+ # 'lib/FreeRTOS-Kernel' : [ 'https://github.com/FreeRTOS/FreeRTOS-Kernel.git', '2a604f4a2818b8354b5e1a39e388eb5e16cfbc1f'],
58
+ # 'lib/lwip' : [ 'https://github.com/lwip-tcpip/lwip.git', '159e31b689577dbf69cf0683bbaffbd71fa5ee10'],
58
59
'lib/sct_neopixel' : [ 'https://github.com/gsteiert/sct_neopixel.git' , 'e73e04ca63495672d955f9268e003cffe168fcd8' ],
59
- 'tools/uf2' : [ 'https://github.com/microsoft/uf2.git' , '19615407727073e36d81bf239c52108ba92e7660' ],
60
+ # 'tools/uf2' : [ 'https://github.com/microsoft/uf2.git', '19615407727073e36d81bf239c52108ba92e7660'],
60
61
}
61
62
62
63
# TOP is tinyusb root dir
@@ -77,21 +78,24 @@ def get_a_dep(d):
77
78
# Init git deps if not existed
78
79
if not p .exists ():
79
80
p .mkdir (parents = True )
80
- subprocess .run ("{} init" .format (git_cmd ), shell = True , stdout = subprocess . PIPE , stderr = subprocess . STDOUT )
81
- subprocess .run ("{} remote add origin {}" .format (git_cmd , url ), shell = True , stdout = subprocess . PIPE , stderr = subprocess . STDOUT )
81
+ subprocess .run ("{} init" .format (git_cmd ), shell = True )
82
+ subprocess .run ("{} remote add origin {}" .format (git_cmd , url ), shell = True )
82
83
83
84
# Check if commit is already fetched
84
85
result = subprocess .run ("{} rev-parse HEAD" .format (git_cmd , commit ), shell = True , stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
85
86
head = result .stdout .decode ("utf-8" ).splitlines ()[0 ]
87
+
86
88
if commit != head :
87
- subprocess .run ("{} fetch --depth 1 origin {}" .format (git_cmd , commit ), shell = True , stdout = subprocess . PIPE , stderr = subprocess . STDOUT )
88
- subprocess .run ("{} checkout FETCH_HEAD" .format (git_cmd ), shell = True , stdout = subprocess . PIPE , stderr = subprocess . STDOUT )
89
+ subprocess .run ("{} fetch --depth 1 origin {}" .format (git_cmd , commit ), shell = True )
90
+ subprocess .run ("{} checkout FETCH_HEAD" .format (git_cmd ), shell = True )
89
91
90
92
return 0
91
93
92
94
93
- status = 0
94
- for d in sys .argv [1 :]:
95
- status += get_a_dep (d )
96
-
97
- sys .exit (status )
95
+ if __name__ == "__main__" :
96
+ status = 0
97
+ all_deps = sys .argv [1 :]
98
+ with Pool () as pool :
99
+ result = pool .map (get_a_dep , all_deps )
100
+ status = sum (result )
101
+ sys .exit (status )
0 commit comments