Skip to content

Commit bb4be83

Browse files
committed
py/makeqstrdefs.py: Print a nicer error when preprocessing stage fails.
Signed-off-by: Damien George <damien@micropython.org>
1 parent 91a3f18 commit bb4be83

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

py/makeqstrdefs.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
_MODE_ROOT_POINTER = "root_pointer"
2929

3030

31+
class PreprocessorError(Exception):
32+
pass
33+
34+
3135
def is_c_source(fname):
3236
return os.path.splitext(fname)[1] in [".c"]
3337

@@ -57,7 +61,10 @@ def preprocess():
5761

5862
def pp(flags):
5963
def run(files):
60-
return subprocess.check_output(args.pp + flags + files)
64+
try:
65+
return subprocess.check_output(args.pp + flags + files)
66+
except subprocess.CalledProcessError as er:
67+
raise PreprocessorError(str(er))
6168

6269
return run
6370

@@ -208,7 +215,12 @@ class Args:
208215
for k, v in named_args.items():
209216
setattr(args, k, v)
210217

211-
preprocess()
218+
try:
219+
preprocess()
220+
except PreprocessorError as er:
221+
print(er)
222+
sys.exit(1)
223+
212224
sys.exit(0)
213225

214226
args.mode = sys.argv[2]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy