Commit 107f97a
[ESP32] Fix compile flag parsing in create_args_gn.py for ESP-IDF v6.0 (project-chip#43668)
* [ESP32] Fix compile flag parsing in create_args_gn.py for ESP-IDF v6.0
ESP-IDF v6.0 stores compile flags in response files (e.g. @"/path/to/cflags")
rather than inline in compile_commands.json. This breaks the GN args generation
as the script was splitting on whitespace without expanding these references.
- Add `expand_response_file()` to read and expand @file references
- Use `shlex.split()` instead of `str.split()` for proper command parsing
- Add `quote_for_gn()` to correctly escape embedded quotes and backslashes
for GN string syntax
* Restyled by autopep8
* Fix expand_response_file to raise on unreadable response files
Silently returning an empty list would drop compile flags and produce
a broken build that is hard to debug. Raise an exception instead so the
error is immediately visible.
---------
Co-authored-by: Restyled.io <commits@restyled.io>1 parent 2027a83 commit 107f97a
1 file changed
Lines changed: 42 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
43 | 68 | | |
44 | 69 | | |
45 | 70 | | |
| |||
52 | 77 | | |
53 | 78 | | |
54 | 79 | | |
| 80 | + | |
55 | 81 | | |
56 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
57 | 88 | | |
58 | 89 | | |
59 | 90 | | |
60 | 91 | | |
61 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
62 | 99 | | |
63 | 100 | | |
64 | 101 | | |
65 | | - | |
| 102 | + | |
66 | 103 | | |
67 | | - | |
| 104 | + | |
68 | 105 | | |
69 | 106 | | |
70 | 107 | | |
| |||
0 commit comments