aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonmain.py
AgeCommit message (Collapse)AuthorFilesLines
2020-09-02Add a notice about Python 3.5 supportNirbheek Chauhan1-2/+14
This will be printed in bold at the end of interactive meson sub-commands that won't be parsed by a program. Specifically: setup, compile, test, and install. NOTICE: You are using [...]
2020-04-21switch python2 %s for python3 .formatMichael1-1/+1
2020-03-04mesonbuild: Add mcompile commandDylan Baker1-1/+3
This is tested working with both msbuild and ninja/samu. Since our xcode support is pretty much broken I didn't bother. Fixes #6670
2019-11-06Fix typos found by codespellWolfgang Stöggl1-5/+5
- Typos were found by codespell v1.16.0
2019-07-23Create multiple different archive types with dist.Jussi Pakkanen1-1/+1
2019-07-23Made dist a top level command.Jussi Pakkanen1-1/+3
2019-04-29Fix builtin variable namesDaniel Mensinger1-15/+15
2019-04-25Don't use len() to test for container emptinessDylan Baker1-1/+1
I ran the numbers once before (it's in the meson history) but it's *much* faster to *not* use len for testing if a container is empty or not.
2019-04-23Don't use mutable types as default argumentsDylan Baker1-1/+2
This isn't safe given the way python implements default arguments. Basically python store a reference to the instance it was passed, and then if that argument is not provided it uses the default. That means that two calls to the same function get the same instance, if one of them mutates that instance every subsequent call that gets the default will receive the mutated instance. The idiom to this in python is to use None and replace the None, def in(value: str, container: Optional[List[str]]) -> boolean: return src in (container or []) if there is no chance of mutation it's less code to use or and take advantage of None being falsy. If you may want to mutate the value passed in you need a ternary (this example is stupid): def add(value: str, container: Optional[List[str]]) -> None: container = container if container is not None else [] container.append(value) I've used or everywhere I'm sure that the value will not be mutated by the function and erred toward caution by using ternaries for the rest.
2019-04-21Can run argument strings with internal Python. Closes #5217.Jussi Pakkanen1-3/+7
2019-03-04Merge pull request #2601 from 1ace/feature/completionJussi Pakkanen1-0/+2
Add completion scripts for Bash and Zsh
2019-03-04rewriter: Remove command aliasDaniel Mensinger1-1/+1
2019-03-04rewriter: make flake8 happyDaniel Mensinger1-1/+1
2019-03-04better formating of the help outputDaniel Mensinger1-7/+12
2019-02-20add note to keep completion scripts updatedEric Engestrom1-0/+2
2019-02-18runpython: insert script's dir into import pathAndrei Alexeyev1-0/+1
Fixes #4947
2019-01-29pep8 py37Michael Hirsch, Ph.D1-1/+1
2019-01-17Merge pull request #4719 from ocrete/fix-posix-langJussi Pakkanen1-0/+17
Replace surrogates with valid codepoints to print env
2019-01-15mesonmain: Force to output UTF-8 even when the locale isn'tOlivier CrĂȘte1-0/+17
Otherwise Python gets all confused and it makes testing difficult. Also minimally emulate the behaviour of the normal object to make the rest of the code happy.
2019-01-07Add new meson.py unstable-coredata subcommand.Martin Hostettler1-1/+3
This adds a hidden option to dump the current otherwise hidden peristant state in coredata.dat. This interface is unstable as meson has no compatibility promises about coredata.dat.
2018-12-02Add 'meson subprojects update' commandXavier Claessens1-1/+3
This is inspired by gst-build's git-update script.
2018-10-04Hide 'rewrite' and 'runpython' commands from helpXavier Claessens1-6/+22
2018-10-04Use a single ArgumentParser for all subcommandsXavier Claessens1-51/+88
This has the adventage that "meson --help" shows a list of all commands, making them discoverable. This also reduce the manual parsing of arguments to the strict minimum needed for backward compatibility.
2018-10-04Simplify run_script_command()Xavier Claessens1-64/+24
2018-10-04Move setup command handling to its own msetup.py fileXavier Claessens1-228/+28
2018-10-04Move set_meson_command() to mesonlibXavier Claessens1-16/+1
2018-09-24Return code 0 when builddir is already configuredXavier Claessens1-1/+1
This is a regression in Meson 0.48.0, commit 674ae46, Meson used to exit(0) when running setup command in a builddir already configured. Changing to exit(1) breaks some build tools that does "meson builddir && ninja -C builddir". Closes #4247.
2018-09-05mesonmain: Add --reconfigure argumentXavier Claessens1-17/+23
Allows to manually reconfigure a project the same way backends would do (e.g. ninja reconfigure). This has the advantage that new options can be set using "meson --reconfigure -Dfoo=bar" and solve situations where a project cannot be reconfigured because new options has been added with the wrong default value. Fixes #3543.
2018-09-05mesonmain: Move builddir/sourcedir handling code inside MesonAppXavier Claessens1-14/+14
2018-09-04Add --fatal-meson-warnings command line optionXavier Claessens1-1/+3
This makes any warning message printed by meson raise an exception, intended to be used by CI and developpers to easily catch deprecation warnings and other potential issues.
2018-08-29Merge pull request #4016 from thiblahute/hotdocJussi Pakkanen1-0/+3
modules: Add an 'hotdoc' module
2018-08-28modules: Add an 'hotdoc' moduleThibault Saunier1-0/+3
hotdoc: http://github.com/hotdoc/hotdoc/
2018-08-22Set wrap_mode to None by default to know if user passed a valueXavier Claessens1-1/+1
2018-08-22mesonmain: Use MesonException instead of RuntimeError in MesonApp initXavier Claessens1-5/+5
2018-08-11Install meson.exe as the entrypoint on WindowsNirbheek Chauhan1-3/+5
Thanks to Rafael Rivera for the suggestion Fixes https://github.com/mesonbuild/meson/issues/1877
2018-07-09Fix directory verification. Closes #3857.Jussi Pakkanen1-2/+11
2018-07-06mlog: Log timestamps in profile-self modeNirbheek Chauhan1-0/+3
This makes it much clearer which statements are taking a long time, and helps in interpreting the outputted profile itself.
2018-06-26Fix glib build when using MSI installer. Closes #3762.Jussi Pakkanen1-1/+5
2018-06-21Print default option values that don't match the current valueNiklas Claesson1-0/+5
2018-06-18Refactored installer to use a class to eradicate global variables.Jussi Pakkanen1-1/+1
2018-06-18Made install a top level Meson command.Jussi Pakkanen1-4/+9
2018-06-06mesonmain: Take only 2 optional directoriesXavier Claessens1-19/+4
If only 1 dir is provided, the 2nd defaults to '.' and if none is provided they default to '.' and '..'. It should be builddir first, followed by sourcedir, but validate_core_dirs() will still swap them if builddir contains a meson.build file.
2018-06-06Remove had_argument_for() it is not used anymoreXavier Claessens1-4/+3
This also means we don't need to keep original command line arguments anymore.
2018-06-06coredata: Stop setting default option values as argparse attributeXavier Claessens1-21/+1
All options are now the projectoptions list, regardless of how they got defined in the command line. This also delays setting builtin option values until the main project() default options are parsed to simplify the code. This is possible because we already delayed setting the backend after parsing main project() in a previous commit.
2018-06-06Delay backend creation until project() is parsedXavier Claessens1-27/+5
The project() function could have a different value for the backend option in its default_options kwargs. Also set backend options, passing them in command line had no effect previously.
2018-06-03Link to our Getting-meson page instead of python.org [skip ci]Nirbheek Chauhan1-1/+1
2018-06-03Error out when someone tries to use msys/python to run MesonNirbheek Chauhan1-0/+10
This mistake seems to be a very common hiccup for people trying to use Meson with MSYS2 on Windows from git or with pip. msys/python uses POSIX paths with '/' as the root instead of a drive like `C:/`, and also does not identify the platform as Windows. This means that configure checks will be wrong, and many build tools will be unable to parse the paths that are returned by functions in Python such as shutil.which. Closes https://github.com/mesonbuild/meson/issues/3653
2018-06-01Set the meson command to use when we know what it isNirbheek Chauhan1-7/+27
Instead of using fragile guessing to figure out how to invoke meson, set the value when meson is run. Also rework how we pass of meson_script_launcher to regenchecker.py -- it wasn't even being used With this change, we only need to guess the meson path when running the tests, and in that case: 1. If MESON_EXE is set in the env, we know how to run meson for project tests. 2. MESON_EXE is not set, which means we run the configure in-process for project tests and need to guess what meson to run, so either - meson.py is found next to run_tests.py, or - meson, meson.py, or meson.exe is in PATH Otherwise, you can invoke meson in the following ways: 1. meson is installed, and mesonbuild is available in PYTHONPATH: - meson, meson.py, meson.exe from PATH - python3 -m mesonbuild.mesonmain - python3 /path/to/meson.py - meson is a shell wrapper to meson.real 2. meson is not installed, and is run from git: - Absolute path to meson.py - Relative path to meson.py - Symlink to meson.py All these are tested in test_meson_commands.py, except meson.exe since that involves building the meson msi and installing it.
2018-05-31Revert "mesonlib: handle meson exe wrappers"Nirbheek Chauhan1-8/+0
This reverts commit 0627e9d616dc311b7c9b0ef17301f680ac9e78a7. Breaks installation: https://github.com/mesonbuild/meson/issues/3647 Will be restored once that can be fixed.
2018-05-30mesonlib: handle meson exe wrappersMartin Kelly1-0/+8
There are cases when it is useful to wrap the main meson executable with a script that sets up environment variables, passes --cross-file, etc. For example, in a Yocto SDK, we need to point to the right meson.cross so that everything "just works", and we need to alter CC, CXX, etc. In such cases, it can happen that the "meson" found in the path is actually a wrapper script that invokes the real meson, which may be in another location (e.g. "meson.real" or similar). Currently, in such a situation, meson gets confused because it tries to invoke itself using the "meson" executable (which points to the wrapper script) instead of the actual meson (which may be called "meson.real" or similar). In fact, the wrapper script is not necessarily even Python, so the whole thing fails. Fix this by using Python imports to directly find mesonmain.py instead of trying to detect it heuristically. In addition to fixing the wrapper issue, this should make the detection logic much more robust.