|
21 | 21 | import pathlib |
22 | 22 | import platform |
23 | 23 | import sys |
| 24 | +import oslex |
24 | 25 |
|
25 | 26 | from .bootstrap import ( |
26 | 27 | DEFAULT_UFBT_HOME, |
@@ -83,30 +84,37 @@ def ufbt_cli(): |
83 | 84 | if not os.path.exists(ufbt_state_dir / "current"): |
84 | 85 | bootstrap_cli(["update"]) |
85 | 86 |
|
86 | | - if not (ufbt_state_dir / "current" / "scripts" / "ufbt").exists(): |
| 87 | + if not ( |
| 88 | + ufbt_script_root := ufbt_state_dir / "current" / "scripts" / "ufbt" |
| 89 | + ).exists(): |
87 | 90 | print("SDK is missing scripts distribution!") |
88 | 91 | print("You might be trying to use an SDK in an outdated format.") |
89 | | - print("Run `ufbt update -h` for more information on how to update.") |
| 92 | + print("You can clean up current state with `ufbt clean --purge`.") |
| 93 | + print("Run `ufbt update -h` for more information on SDK installation.") |
90 | 94 | return 1 |
91 | 95 |
|
92 | 96 | UFBT_APP_DIR = os.getcwd() |
93 | 97 |
|
94 | 98 | if platform.system() == "Windows": |
95 | | - commandline = ( |
96 | | - r'call "%UFBT_STATE_DIR%/current/scripts/toolchain/fbtenv.cmd" env & ' |
97 | | - "python -m SCons -Q --warn=target-not-built " |
98 | | - r'-C "%UFBT_STATE_DIR%/current/scripts/ufbt" ' |
99 | | - f'"UFBT_APP_DIR={UFBT_APP_DIR}" ' + " ".join(sys.argv[1:]) |
100 | | - ) |
101 | | - |
| 99 | + commandline = r'call "%UFBT_STATE_DIR%/current/scripts/toolchain/fbtenv.cmd" env & python ' |
102 | 100 | else: |
103 | 101 | commandline = ( |
104 | | - '. "$UFBT_STATE_DIR/current/scripts/toolchain/fbtenv.sh" && ' |
105 | | - "python3 -m SCons -Q --warn=target-not-built " |
106 | | - '-C "$UFBT_STATE_DIR/current/scripts/ufbt" ' |
107 | | - f'"UFBT_APP_DIR={UFBT_APP_DIR}" ' + " ".join(sys.argv[1:]) |
| 102 | + '. "$UFBT_STATE_DIR/current/scripts/toolchain/fbtenv.sh" && python3 ' |
108 | 103 | ) |
109 | 104 |
|
| 105 | + commandline += oslex.join( |
| 106 | + [ |
| 107 | + "-m", |
| 108 | + "SCons", |
| 109 | + "-Q", |
| 110 | + "--warn=target-not-built", |
| 111 | + "-C", |
| 112 | + str(ufbt_script_root), |
| 113 | + f"UFBT_APP_DIR={UFBT_APP_DIR}", |
| 114 | + *sys.argv[1:], |
| 115 | + ] |
| 116 | + ) |
| 117 | + |
110 | 118 | # print(commandline) |
111 | 119 | retcode = os.system(commandline) |
112 | 120 | if platform.system() != "Windows": |
|
0 commit comments