forked from SpacehuhnTech/arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.py
32 lines (26 loc) · 747 Bytes
/
init.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
import subprocess
import shlex
import json
projects = {}
with open("projects.json") as f:
projects = json.load(f)
def subprocess_cmd(command):
process = subprocess.Popen(command,stdout=subprocess.PIPE, shell=True)
proc_stdout = process.communicate()[0].strip()
print(proc_stdout)
for project in projects:
for package in projects[project]:
cmd = f"""
cd {project};
rm -rf {package} -f;
git clone https://github.com/SpacehuhnTech/arduino-{package} {package};
cd {package};
git fetch;
git checkout {project};
git pull;
git submodule update --init --recursive;
cd ..;
cd ..;
"""
subprocess_cmd(cmd)