You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by "harrysarson (via GitHub)" <gi...@apache.org> on 2025/04/30 15:31:37 UTC
[I] Variables from boolean project options resolved to 0/1 instead of true/false [buildstream]
harrysarson opened a new issue, #2006:
URL: https://github.com/apache/buildstream/issues/2006
If I have in my `project.conf`
```
options:
option_name:
type: bool
description: ''
default: false
variable: option-variable
elements:
some_plugin:
(@): includes/some_plugin.yml
```
and in `includes/some_plugin.yml`
```
config:
some_config: '%{option-variable}'
```
and then the plugin does
```
print(f"config was {node.get_str('some_config')}")
node.get_bool("some_config")
```
then resolving elements fails with an error message along the lines of
```
16:26:00 --:--:-- main:core activity START Build
16:26:01 --:--:-- main:core activity START Loading elements
16:26:01 00:00:00 main:core activity SUCCESS Loading elements
16:26:01 --:--:-- main:core activity START Resolving elements
config was 0
16:26:02 00:00:00 main:core activity FAILURE Resolving elements
16:26:02 00:00:01 main:core activity FAILURE Build
includes/some_plugin-conf.yml [line 8 column 42]: Value of 'some_config' is not of the expected type 'bool'
```
I.e. the variable ends up being `0` rather than `false` which makes `node.get_bool` fail.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Variables from boolean project options resolved to 0/1 instead of true/false [buildstream]
Posted by "harrysarson (via GitHub)" <gi...@apache.org>.
harrysarson commented on issue #2006:
URL: https://github.com/apache/buildstream/issues/2006#issuecomment-2842390276
CC @gtristan
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Variables from boolean project options resolved to 0/1 instead of true/false [buildstream]
Posted by "gtristan (via GitHub)" <gi...@apache.org>.
gtristan commented on issue #2006:
URL: https://github.com/apache/buildstream/issues/2006#issuecomment-2845134172
Interesting, this looks like the cause is that `OptionBool.get_value()` returns the strings "0" or "1".
While that *could* be changed, I wonder if the safer option would be to have `MappingNode.get_bool()` recognize "0" and non zero numerical values as legitimate values for `False` and `True`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Variables from boolean project options resolved to 0/1 instead of true/false [buildstream]
Posted by "gtristan (via GitHub)" <gi...@apache.org>.
gtristan closed issue #2006: Variables from boolean project options resolved to 0/1 instead of true/false
URL: https://github.com/apache/buildstream/issues/2006
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org