mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.47k stars 1.58k forks source link

Unclear default value for unity-size and python.bytecompile in "meson setup --help" output #13325

Open radioactiveman opened 2 months ago

radioactiveman commented 2 months ago

Describe the bug meson setup --help prints confusing information for the options --unity-size and --python.bytecompile. It looks like the supported values are listed here instead of the default value.

options:
  --unity-size UNITY_SIZE                    Unity block size (default: (2, None, 4)).
  --python.bytecompile PYTHON.BYTECOMPILE    Whether to compile bytecode (default: (-1, 2, 0)).

To reproduce meson setup --help

Expected behavior Only one (the actual) default value should be stated here. The supported values should be printed in the first column. --optimization does it like this:

options:
  --optimization {plain,0,g,1,2,3,s}         Optimization level (default: 0).

System parameters

Additional information

MikhailRyazanov commented 1 month ago

Another question, unrelated to --help but about the python.bytecompile behavior: why does it use force=True here? https://github.com/mesonbuild/meson/blob/dc1b4be6be321e39d21604ab4287c9ce972be4da/mesonbuild/scripts/pycompile.py#L35-L37 This results in recompiling all output files every time, even if most haven't changed, thus noticeably damaging performance in incremental builds (for example, SciPy has ~900 .py files, and recompiling them all just wastes several seconds every time).

I think, force=True should be removed, letting compile_file() to skip up-to-date files. Or, if using force=True has any real purpose, it should be optional.

eli-schwartz commented 1 month ago

meson setup --help prints confusing information for the options --unity-size and --python.bytecompile. It looks like the supported values are listed here instead of the default value.

It's a quirk of UserIntegerOption and its technically incorrect data structure, which passes the range for choices in, overloaded as default_value, then processes the result to set self.choices. Probably, this can be fixed.

eli-schwartz commented 1 month ago

@MikhailRyazanov then perhaps that should be its own distinct ticket?

MikhailRyazanov commented 1 month ago

perhaps that should be its own distinct ticket?

If it doesn't have an obvious answer (I thought I'm just missing something), then I can definitely create a separate issue.