Commit Graph

142 Commits

Author SHA1 Message Date
Michael Hirsch, Ph.D da34bea893 pep8 py37 2019-01-29 22:06:11 +02:00
Jussi Pakkanen e6df5a7586
Merge pull request #4719 from ocrete/fix-posix-lang
Replace surrogates with valid codepoints to print env
2019-01-17 00:40:56 +02:00
Olivier Crête 92b343f2f7 mesonmain: Force to output UTF-8 even when the locale isn't
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-15 14:01:32 -05:00
Martin Hostettler 768fa502ac Add new meson.py unstable-coredata subcommand.
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.
2019-01-07 22:55:45 +02:00
Xavier Claessens 60b58e056f Add 'meson subprojects update' command
This is inspired by gst-build's git-update script.
2018-12-02 08:37:32 -05:00
Xavier Claessens adae6b56de Hide 'rewrite' and 'runpython' commands from help 2018-10-04 09:40:21 -04:00
Xavier Claessens 37067a53c4 Use a single ArgumentParser for all subcommands
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-04 09:40:21 -04:00
Xavier Claessens 5af2717e76 Simplify run_script_command() 2018-10-04 09:40:21 -04:00
Xavier Claessens f8913d1d28 Move setup command handling to its own msetup.py file 2018-10-04 09:40:21 -04:00
Xavier Claessens 246d5d86f5 Move set_meson_command() to mesonlib 2018-10-04 09:39:26 -04:00
Xavier Claessens 2f0285c7ef Return code 0 when builddir is already configured
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-24 10:58:53 -04:00
Xavier Claessens 674ae466c8 mesonmain: Add --reconfigure argument
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-05 12:54:19 -04:00
Xavier Claessens 8de60f9078 mesonmain: Move builddir/sourcedir handling code inside MesonApp 2018-09-05 12:53:56 -04:00
Xavier Claessens ef231d3edd Add --fatal-meson-warnings command line option
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-09-04 09:01:39 -04:00
Jussi Pakkanen b86f2fd17f
Merge pull request #4016 from thiblahute/hotdoc
modules: Add an 'hotdoc' module
2018-08-29 21:18:26 +03:00
Thibault Saunier 378bd4df0e modules: Add an 'hotdoc' module
hotdoc: http://github.com/hotdoc/hotdoc/
2018-08-28 18:18:40 -03:00
Xavier Claessens 05cab3dee5 Set wrap_mode to None by default to know if user passed a value 2018-08-22 15:15:54 -04:00
Xavier Claessens 55bbb3600f mesonmain: Use MesonException instead of RuntimeError in MesonApp init 2018-08-22 15:15:54 -04:00
Nirbheek Chauhan 2ee28029f9 Install meson.exe as the entrypoint on Windows
Thanks to Rafael Rivera for the suggestion

Fixes https://github.com/mesonbuild/meson/issues/1877
2018-08-11 03:19:57 +05:30
Jussi Pakkanen 09ad29ec56 Fix directory verification. Closes #3857. 2018-07-09 23:14:59 +02:00
Nirbheek Chauhan e4417eb301 mlog: Log timestamps in profile-self mode
This makes it much clearer which statements are taking a long time,
and helps in interpreting the outputted profile itself.
2018-07-06 06:25:12 +00:00
Jussi Pakkanen ce7cdadd37 Fix glib build when using MSI installer. Closes #3762. 2018-06-26 23:01:52 +03:00
Niklas Claesson 9620755ff7 Print default option values that don't match the current value 2018-06-21 00:56:30 +03:00
Jussi Pakkanen 6a21e19515 Refactored installer to use a class to eradicate global variables. 2018-06-18 22:12:13 +03:00
Jussi Pakkanen 6cf79f86ee Made install a top level Meson command. 2018-06-18 22:02:56 +03:00
Xavier Claessens 7fbe10ac8d mesonmain: Take only 2 optional directories
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-06 20:02:37 +00:00
Xavier Claessens f4d60acaa9 Remove had_argument_for() it is not used anymore
This also means we don't need to keep original command line arguments
anymore.
2018-06-06 20:02:37 +00:00
Xavier Claessens 75e501ceb8 coredata: Stop setting default option values as argparse attribute
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-06 20:02:37 +00:00
Xavier Claessens 5af98d16b9 Delay backend creation until project() is parsed
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-06 20:02:37 +00:00
Nirbheek Chauhan 8e8d3231ad Link to our Getting-meson page instead of python.org [skip ci] 2018-06-03 18:59:24 +00:00
Nirbheek Chauhan 107e061506 Error out when someone tries to use msys/python to run Meson
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-03 18:59:24 +00:00
Nirbheek Chauhan 0a035dea6d Set the meson command to use when we know what it is
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-06-01 19:20:04 +00:00
Nirbheek Chauhan f56b402a5b Revert "mesonlib: handle meson exe wrappers"
This reverts commit 0627e9d616.

Breaks installation: https://github.com/mesonbuild/meson/issues/3647

Will be restored once that can be fixed.
2018-05-31 15:40:10 +05:30
Martin Kelly 0627e9d616 mesonlib: handle meson exe wrappers
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-30 18:29:16 +00:00
Nirbheek Chauhan a6c9f98c57 depfixer: We no longer run this as a script 2018-05-24 14:38:28 +00:00
Jussi Pakkanen e3be7f7021 Write coredata transactionally. Closes #3511. 2018-05-21 00:48:25 +03:00
Jussi Pakkanen d52f892de9
Merge pull request #3485 from xclaesse/warnlevel
--warnlevel got renamed to --warning-level
2018-04-29 20:27:43 +03:00
Nirbheek Chauhan 900c23f98a New argument: --profile-self for profiling performance
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-27 23:14:16 +03:00
Xavier Claessens 570c108635 Fix --warnlevel being renamed to --warning-level in latest release 2018-04-27 11:09:14 -04:00
Xavier Claessens cb5ad2f211 Remove duplicated definition of -D cmdline arg 2018-04-26 22:46:40 -04:00
Dylan Baker 8120ff9cf7 Move builtin_argument_registration to coredata
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-17 11:32:26 -07:00
Dylan Baker 78e37c4953 Accept builtin options with -D when making initial meson call
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-17 11:32:26 -07:00
Dylan Baker cdefc15285 mesonmain: be DRY
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-17 11:32:26 -07:00
Dylan Baker 1452eb73c1 coredata: encapsulate destination name
This means that there are no special args passed ot builtin args
anymore.
2018-04-17 11:32:26 -07:00
Dylan Baker bbf71d9aa3 coredata: Add helper for setting action
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-17 11:32:26 -07:00
Jussi Pakkanen bdb57cf62a Convert Gnome module to use find_program from interpreter. 2018-04-15 13:32:38 +05:30
Jussi Pakkanen 58156ef7cf Grab a file lock on the build dir during modifications. 2018-03-20 22:28:37 +02:00
Jukka Laurila 52c50da6c7 Refactor: Add log.error and log.exception to reduce code duplication. 2018-03-10 18:04:52 +02:00
Jukka Laurila 048508c989 Make "meson help" and "meson help <subcommand>" do the expected thing. 2018-03-06 14:02:55 +02:00
Hemmo Nieminen 7fb8e518b2 Harmonize data pickling.
Try to be more consistent on using save() and load() methods to pickle
data.
2018-03-01 01:06:51 +02:00