olofk / fusesoc

Package manager and build abstraction tool for FPGA/ASIC development
BSD 2-Clause "Simplified" License
1.21k stars 246 forks source link

Bugs of flags only with numeric #683

Open BaseHardware opened 8 months ago

BaseHardware commented 8 months ago

If I give a flag only with numeric as follows, FuseSoC fails to parse the core files.

targets:
  default:
    flags:
      blah: 1234

The problem is that it crashes without any proper messages but only with interpreting error messages from python3 as follows:

  File "/home/aaaa/.local/lib/python3.12/site-packages/fusesoc/capi2/exprs.py", line 202, in expand
    flag_defs = Exprs._flags_to_flag_defs(flags)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aaaa/.local/lib/python3.12/site-packages/fusesoc/capi2/exprs.py", line 194, in _flags_to_flag_defs
    ret.append(k + "_" + v)
               ~~~~~~~~^~~
TypeError: can only concatenate str (not "int") to str

Please fix this bug. I think replacing ret.append(k + "_" + v) to ret.append(k + "_" + str(v)) is enough to fix this bug.