Skip to content

Commit 7c9bd81

Browse files
committed
update deps script
1 parent d41320a commit 7c9bd81

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

tools/get_deps.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import sys
22
import subprocess
33
from pathlib import Path
4+
from multiprocessing import Pool
45

5-
# path, url, commit
6+
# path, url, commit (Alphabet sorted by path)
67
deps_list = {
78
'hw/mcu/allwinner' : [ 'https://github.com/hathach/allwinner_driver.git', '8e5e89e8e132c0fd90e72d5422e5d3d68232b756'],
89
'hw/mcu/bridgetek/ft9xx/ft90x-sdk' : [ 'https://github.com/BRTSG-FOSS/ft90x-sdk.git', '91060164afe239fcb394122e8bf9eb24d3194eb1'],
@@ -53,10 +54,10 @@
5354
'hw/mcu/ti' : [ 'https://github.com/hathach/ti_driver.git', '143ed6cc20a7615d042b03b21e070197d473e6e5'],
5455
'hw/mcu/wch/ch32v307' : [ 'https://github.com/openwch/ch32v307.git', '17761f5cf9dbbf2dcf665b7c04934188add20082'],
5556
'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'],
5859
'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'],
6061
}
6162

6263
# TOP is tinyusb root dir
@@ -77,21 +78,24 @@ def get_a_dep(d):
7778
# Init git deps if not existed
7879
if not p.exists():
7980
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)
8283

8384
# Check if commit is already fetched
8485
result = subprocess.run("{} rev-parse HEAD".format(git_cmd, commit), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
8586
head = result.stdout.decode("utf-8").splitlines()[0]
87+
8688
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)
8991

9092
return 0
9193

9294

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)

tools/get_family_deps.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
import subprocess
33
import os
44

5+
# TOP is tinyusb root dir
6+
TOP = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
57

68
def get_family_dep(family):
7-
for entry in os.scandir("hw/bsp/{}/boards".format(family)):
9+
for entry in os.scandir("{}/hw/bsp/{}/boards".format(TOP, family)):
810
if entry.is_dir():
9-
result = subprocess.run("make -C examples/device/board_test BOARD={} get-deps".format(entry.name),
11+
result = subprocess.run("make -C {}/examples/device/board_test BOARD={} get-deps".format(TOP, entry.name),
1012
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
1113
print(result.stdout.decode("utf-8"))
1214
return result.returncode

0 commit comments

Comments
 (0)