|
15 | 15 | script_path = Path(__file__).parent.resolve()
|
16 | 16 | sys.path.append(str(script_path.parent))
|
17 | 17 | from utils import copyFile, copyFolder, createFolder, deleteFolder, genSTM32List
|
| 18 | +from utils import execute_cmd, getRepoBranchName |
18 | 19 |
|
19 | 20 | if sys.platform.startswith("win32"):
|
20 | 21 | from colorama import init
|
|
74 | 75 | out_separator = "-" * 70
|
75 | 76 |
|
76 | 77 |
|
77 |
| -def execute_cmd(cmd, stderror): |
78 |
| - try: |
79 |
| - output = subprocess.check_output(cmd, stderr=stderror).decode("utf-8").strip() |
80 |
| - except subprocess.CalledProcessError as e: |
81 |
| - print("Failed command: ") |
82 |
| - print(e.cmd) |
83 |
| - exit(e.returncode) |
84 |
| - return output |
85 |
| - |
86 |
| - |
87 | 78 | def create_config(config_file_path):
|
88 | 79 | global repo_local_path
|
89 | 80 |
|
@@ -238,22 +229,6 @@ def createSystemFiles(serie):
|
238 | 229 | copyFile(hal_conf_file, hal_conf_default)
|
239 | 230 |
|
240 | 231 |
|
241 |
| -def getRepoBranchName(repo_path): |
242 |
| - bname = "" |
243 |
| - rname = "" |
244 |
| - cmd = ["git", "-C", repo_path, "branch", "-r"] |
245 |
| - bnames = execute_cmd(cmd, None).split("\n") |
246 |
| - for b in bnames: |
247 |
| - name_match = re.match(r"\S+/\S+ -> (\S+)/(\S+)", b.strip()) |
248 |
| - if name_match: |
249 |
| - rname = name_match.group(1) |
250 |
| - bname = name_match.group(2) |
251 |
| - if not bname: |
252 |
| - print(f"Could not find branch name for {repo_path}!") |
253 |
| - exit(1) |
254 |
| - return (rname, bname) |
255 |
| - |
256 |
| - |
257 | 232 | def updateCoreRepo():
|
258 | 233 | # Handle core repo
|
259 | 234 | repo_path = repo_local_path / repo_core_name
|
|
0 commit comments