mesonbuild / meson-python

Meson PEP 517 Python build backend
https://mesonbuild.com/meson-python/
MIT License
118 stars 59 forks source link

Vague error when file not in git when building package #533

Closed GuillaumeQuenneville closed 7 months ago

GuillaumeQuenneville commented 7 months ago

I just started using mesonpy and I went through the tutorial and hit a temporary wall that I think could be clarified. When creating a new file but before comiting the file to the git repository, the editable installs worked and the pip install . works. But running pipx run build or python -m build . resulted in

...
../meson.build:3:0: ERROR: Nonexistent build file 'src/meson.build'
...

or

../src/meson.build:10:3: ERROR: File bar.pyx does not exist.

even though the files existed.

If you haven not staged the changes then you get no warning that explains the reason why this is happening.

If you have staged changes, the issue appears earlier in the output with the warning WARNING: Repository has uncommitted changes that will not be included in the dist tarball.

../meson.build:3:0: ERROR: Nonexistent build file 'src/meson.build' also led me down a different rabbit trail that took some time to figure out.

I don't personally think we need to change anything in mesonpy or meson unless catching this is easily done. But I think the https://meson-python.readthedocs.io/en/latest/how-to-guides/config-settings.html wiki page could be reworked into a "Building your package" page that includes a warning about this. I'd be happy to submit a PR with whatever you suggest.

GuillaumeQuenneville commented 7 months ago

Found it in the docs https://meson-python.readthedocs.io/en/latest/tutorials/introduction.html#building-the-project