question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Call meson using python -m meson

See original GitHub issue

Feature Request I would like to call meson using

python -m meson <args>

docs: __main__.py Adding a simple __main__.py would solve this issue. But I noticed that the module name mesonbuild rather meson is there a particular reason why it is named so?

Use Case

I am on Appveyor and I would like to meson there using their python because I am building something which requires the python header, so I could easily shift between x86 and x64 python version using direct path instead of path manipulation. I would simply call it using direct path rather than path manipulation.

Also, this would be so helpful, if I run it inside a python scipt and I could get the python executable using

import sys
print(sys.executable)

So, I could simply call it using the path recieved. Now, I find a __main__.py in repo, but why is it in root directory rather than inside mesonbuild directory?

The solution

Copy the meson.py (with slight edit) inside the mesonbuild(should be meson?) as __main__.py and it is fixed.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
eli-schwartzcommented, Nov 23, 2020

@naveen521kk,

You can currently do this via python -m mesonbuild.mesonmain.

The __main__.py file is intended merely to make this usable via python -m zipapp /path/to/meson-checkout to create a single-file executable out of the box. Although I don’t know that it’s doing a great job of it. 😮

0reactions
eli-schwartzcommented, Dec 10, 2020

The “executables” created by Setuptools are just Python scripts (at least on non-Windows). You can do /path/to/somepython3 /path/to/meson <args> and it should work. I just tested it with a different program in a virtualenv and it seemed to work.

The python script merely imports mesonbuild and calls the entrypoint main function. So I don’t see how this could possibly work… unless multiple python versions each have mesonbuild installed to site-packages…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using via meson — NumPy v1.24 Manual
Meson needs to be at-least 0.46.0 in order to resolve the python include directories. ... python -n numpy.f2py fib1.f -m fib2. Now, consider...
Read more >
Getting Meson
Meson is implemented in Python 3, and requires 3.7 or newer. ... Meson releases can be downloaded from the GitHub release page, and...
Read more >
How to launch an external Python program from Meson?
Before building my project, I have to generate a C++ source file through a Python script, using the Meson build system.
Read more >
Compilation and Installation Using Meson - Mesa 3D
You will need to install Python 3 and Meson as a module using pip. This is because we use Python for generating code,...
Read more >
How to build SciPy with Meson
meson : the Meson build system, installable as a pure Python package from PyPI or conda-forge · ninja : the build tool invoked...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found