aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonmain.py
AgeCommit message (Collapse)AuthorFilesLines
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.
2018-05-24depfixer: We no longer run this as a scriptNirbheek Chauhan1-3/+0
2018-05-21Write coredata transactionally. Closes #3511.Jussi Pakkanen1-1/+5
2018-04-29Merge pull request #3485 from xclaesse/warnlevelJussi Pakkanen1-6/+5
--warnlevel got renamed to --warning-level
2018-04-27New argument: --profile-self for profiling performanceNirbheek Chauhan1-3/+16
Outputs two profile logs: one for the interpreter run and another for the backend-specific build file generation. Both are stored in meson-private in the build directory.
2018-04-27Fix --warnlevel being renamed to --warning-level in latest releaseXavier Claessens1-4/+5
2018-04-26Remove duplicated definition of -D cmdline argXavier Claessens1-2/+0
2018-04-17Move builtin_argument_registration to coredataDylan Baker1-21/+1
We're going to want to use these functions in meson configure as well to make the command line options the same between `meson` and `meson configure`.
2018-04-17Accept builtin options with -D when making initial meson callDylan Baker1-0/+20
Currently meson only accepts `-Dopt=value` for builtin options when calling `meson configure` and `--opt=value` for builtin options when calling `meson` initially. This is a confusing behavior, and users only get a small warning at the top of a potentially long configuration summary to catch this. This has confused end users and developers alike, there are at least 5 duplicates of the bug this fixes, and I have personally been asked about this more times than I can count. The help documentation doesn't make it clear that -D cannot be used to set options like prefix and bindir. This adds support for -D options to the initial meson call, but not -- options to the meson configure call. I think it's better to have one way to do things, and -- options are kinda one off while -D is used everywhere else, so lets stick with that. Related #969
2018-04-17mesonmain: be DRYDylan Baker1-24/+4
We have all the information needed to calculate the builtin arguments in the coredata module already, don't duplicate that in the mesonmain module as well.
2018-04-17coredata: encapsulate destination nameDylan Baker1-2/+2
This means that there are no special args passed ot builtin args anymore.
2018-04-17coredata: Add helper for setting actionDylan Baker1-5/+7
Currently we manually pass the argparse action, this isn't very DRY, since the builtin_types already has all the data necessary to find that. This adds a new function to determine the action based on the default type.
2018-04-15Convert Gnome module to use find_program from interpreter.Jussi Pakkanen1-1/+2
2018-03-20Grab a file lock on the build dir during modifications.Jussi Pakkanen1-1/+2
2018-03-10Refactor: Add log.error and log.exception to reduce code duplication.Jukka Laurila1-10/+4
2018-03-06Make "meson help" and "meson help <subcommand>" do the expected thing.Jukka Laurila1-0/+7
2018-03-01Harmonize data pickling.Hemmo Nieminen1-6/+4
Try to be more consistent on using save() and load() methods to pickle data.
2018-02-15Verify that failing tests are failing with an error, not a python exceptionJon Turney1-1/+2
PR #2527 suggests "making failing tests more strict about failing gracefully". To achive this, make meson exit with distinct exit statuses for meson errors and python exceptions, and check the exit status is as expected for failing tests. I can't see how to write a test for this, within the current framework. You can test this change by reverting the fix (but not the test) from commit 1a159db8 and verifying that 'test cases/failing/66 string as link target' fails.
2018-02-14Ensure any generation error appears in the logfile and thus in CI outputJon Turney1-4/+5
Since c2a5ac39, MesonApp.generate() closes the logfile before returning, which means that when invoked by mesonmain.run(), any MesonException is not logged there. MesonApp.generate() does not appear to have any other users I can find. This somewhat reduces the diagnostic value of the logfile. This also interacts badly with running project tests in CI, as _run_tests chooses to report the logfile contents, rather than stdout, for the configure step, and it thus doesn't report any configure error which caused a test failure.
2018-01-30Report warning/error locations in a format IDEs may already know how to parseJon Turney1-2/+3
Examples: meson.build:2:0: ERROR: Dependency is both required and not-found meson.build:4: WARNING: Keyword argument "link_with" defined multiple times. These are already matched by the default compilation-error-regexp-alist in emacs. Also: Don't start 'red' markup until after the \n before an error Unabsorb full-stop at end of warning with location from mlog.warning() Update warning_location test
2018-01-18Removed duplicate if branch.Jussi Pakkanen1-2/+0
2018-01-04Bump minimum supported Python from 3.4 to 3.5.Jussi Pakkanen1-2/+2
2017-12-31Added init command that creates a sample exe project.Jussi Pakkanen1-1/+3
2017-12-30Remember which Visual Studio backend was auto-detectedGabrĂ­el ArthĂșr PĂ©tursson1-0/+1
This fixes the REGEN build target since VSINSTALLDIR does not get set by Visual Studio when building targets. Fixes #2848.
2017-12-19mesonmain: Remove useless ternaryDylan Baker1-1/+1
This ternary checks the value of a bool, and returns the same value.
2017-11-28Don't print traceback when options are invalidDylan Baker1-1/+5
Currently passing a bad combo or array option, providing a non-boolean to a bool arg, or a host of other things can cause an traceback from a MesonException, don't do that. Fixes #2683
2017-11-20Make the full test suite runnable with an external command.Jussi Pakkanen1-42/+44
2017-11-20Replaced sys.executable use with the mesonlib equivalent.Jussi Pakkanen1-1/+1
2017-11-20Add command to run Python scripts with the current interpreter.Jussi Pakkanen1-0/+6
2017-11-13Merge pull request #2511 from jon-turney/prefix-dependent-defaultsJussi Pakkanen1-1/+6
Make sysconfdir, localstatedir and sharedstatedir defaults depend on prefix
2017-11-09Print correct command in help messageEric Engestrom1-1/+1
Taking mconf for instance: before: $ meson configure --help usage: meson [-h] [-D SETS] [--clearcache] [directory [directory ...]] after: $ meson configure --help usage: meson configure [-h] [-D SETS] [--clearcache] [directory [directory ...]]
2017-11-06Dump coredata earlier.Elliott Sales de Andrade1-16/+12
Unfortunately, `time.time` and file timestamps are not guaranteed to be in sync and due to various kernel caches may be different enough to cause rebuilds to fail [1]. This was masked by older ninja versions that could not read sub-second timestamps. [1] https://travis-ci.org/mesonbuild/meson/jobs/296797872
2017-10-28Make sysconfdir, localstatedir and sharedstatedir defaults depend on prefixJon Turney1-1/+6
Rather than requiring a bit of boilerplate in every meson.build, which is only documented in a comment in mesoncore.py, use sensible defaults for sysconfdir, localstatedir and sharedstatedir depending on the prefix. Fixes #1637 v2: For clarity, give get_builtin_option_default() a noneIfSuppress argument, rather than overloading prefix '' and None with special meanings.
2017-09-21flake8: Perform suggested whitespace/formatting changesLuke Shumaker1-5/+5
This only touches newlines, spaces, and (occaisionally) commas. Anything else is left for another commit.
2017-09-14logging: Print location of log file on errorNirbheek Chauhan1-1/+5
Similar to configure Closes https://github.com/mesonbuild/meson/issues/2316
2017-09-12Update message for already configured builddirChet Gurevitch1-7/+6
2017-09-07wrap-mode: Make the error output more usefulNirbheek Chauhan1-1/+9
Now it errors out while displaying the possible options See: https://bugs.python.org/issue25061 for native support
2017-08-20Merge pull request #2163 from chetgurevitch/masterJussi Pakkanen1-4/+5
Don't error if build directory is already configured and update instructions
2017-08-18Ensure log file gets closed.Jussi Pakkanen1-0/+6
2017-08-18Tell users about ninja rebuild and meson configureChet Gurevitch1-2/+3