Skip to content

Commit 77d870f

Browse files
authored
Merge pull request #861 from zapta/main
Change the style of the apio.ini macros from {my-macro} to ${MY_MACRO}.
2 parents 0d755c3 + 1a8d738 commit 77d870f

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

apio/managers/project.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,13 @@ def _parse_env_options(
364364
# -- Key/Value dict for macro expansion.
365365
macros = {
366366
# -- The ';' char. (de-conflicted from ; comment)
367-
"{semicolon}": ";",
367+
"${SEMICOLON}": ";",
368368
# -- The '#' char. (de-conflicted from # comment)
369-
"{hash}": "#",
369+
"${HASH}": "#",
370370
# -- The env name.
371-
"{env-name}": env_name,
371+
"${ENV_NAME}": env_name,
372372
# -- The relative path to env build directory (linux / style)
373-
"{env-build}": (PROJECT_BUILD_PATH / env_name).as_posix(),
373+
"${ENV_BUILD}": (PROJECT_BUILD_PATH / env_name).as_posix(),
374374
}
375375

376376
# -- Select the env section by name.

docs/project-file.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,23 @@ At runtime, apio select the env to use based using the following rules in decrea
3838
2. The value of the `default-env` option in the `[apio]` section, if exists.
3939
3. The first env that is listed in `apio.ini`.
4040

41-
4241
When apio determines the env to use, it collects its options
4342
from the `[common]` and the [env:name] section, with options in the `[env:name]` section
4443
having higher priority, and executes the command with the resolved set options.
4544

46-
## Value macros
45+
## Project macros
4746

48-
When processing env values, apio replaces the following macros with their
47+
When processing env values in apio.ini, apio replaces the following macros with their
4948
respective values.
5049

51-
| MACRO_NAME | VALUE |
52-
| :------------ | :--------------------------------------------------------------- |
53-
| `{semicolon}` | The character `;` |
54-
| `{hash}` | The character `#` |
55-
| `{env-name}` | The env name, e.g. `my-env`. |
56-
| `{env-build}` | The posix path of the env build directory, e.g. `_build/my-env`. |
50+
| MACRO_NAME | VALUE |
51+
| :------------- | :--------------------------------------------------------------- |
52+
| `${SEMICOLON}` | The character `;` |
53+
| `${HASH}` | The character `#` |
54+
| `${ENV_NAME}` | The env name, e.g. `my-env`. |
55+
| `${ENV_BUILD}` | The posix path of the env build directory, e.g. `_build/my-env`. |
56+
57+
> Hint: The `${SEMICOLON}` and `${HASH}` macros are provided to avoid interpretation as comment markers.
5758
5859
---
5960

@@ -279,6 +280,6 @@ diagnosing Yosys related synthesis issues.
279280
board = alhambra-ii
280281
top-module = leds
281282
yosys-extra-options =
282-
{semicolon} write_verilog {env-build}/yosys-synth.v
283+
${SEMICOLON} write_verilog ${ENV_BUILD}/yosys-synth.v
283284
``
284285
```

tests/unit_tests/managers/test_project.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ def test_macro_expansion(apio_runner: ApioRunner, capsys: LogCaptureFixture):
163163
"[env:default]": {
164164
"board": "alhambra-ii",
165165
"top-module": "my_top_module",
166-
"constraint-file": " {semicolon} value ",
167-
"yosys-extra-options": " k1={env-build}/v1 k2=v2; \n ; "
168-
"Comment \n k3=v3{hash} {env-name}\n\n",
166+
"constraint-file": " ${SEMICOLON} value ",
167+
"yosys-extra-options": " k1=${ENV_BUILD}/v1 k2=v2; \n ; "
168+
"Comment \n k3=v3${HASH} ${ENV_NAME}\n\n",
169169
}
170170
},
171171
env_arg=None,

0 commit comments

Comments
 (0)