mesonbuild / mesonbuild/meson-python

Default -Dbuildtype=release cannot be overridden by native file

Open
#828 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
180
Forks
93
Avg merge
2d 7h
Merged PRs (30d)
18

Description

I find it quite convenience to package together build options using Meson's [native files](https://mesonbuild.com/Native-environments.html). Unfortunately if I try to set the build type in a native file like e.g.:

```toml
[built-in options]
buildtype = 'debug'
```

this will not override the `-Dbuildtype` given by meson-python here (even though it's given earlier in the command line):

https://github.com/mesonbuild/meson-python/blob/cfcfb3554800d42c859d04309da2c1973c9f97ce/mesonpy/__init__.py#L874

I'm not sure whether this is something that should be fixed in Meson or meson-python. One workaround could be to put these defaults in a native file specified earlier in the command line. This should cause them to be overwritten by the user native file correctly.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in mesonpy/__init__.py around line 874 and reproduce the native-file buildtype behavior described in the issue. Compare how meson-python supplies -Dbuildtype with Meson's native-file precedence rules, then verify that a native file can provide the intended default without preventing explicit user settings from taking effect.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.