Commit Graph

161 Commits

Author SHA1 Message Date
Xavier Claessens 598e968993 Add `meson devenv` command and meson.add_devenv() 2021-03-16 09:00:50 -04:00
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
Jussi Pakkanen bca90722ec Bump minimum supported Python version to 3.6. Closes #6297. 2020-10-30 11:18:11 +02:00
Nirbheek Chauhan 4ad4565ddd Add a notice about Python 3.5 support
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-09-02 10:37:40 +00:00
Michael c53b637959 switch python2 %s for python3 .format 2020-04-21 00:16:21 +03:00
Dylan Baker 1210a67f66 mesonbuild: Add mcompile command
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes #6670
2020-03-04 14:07:27 -05:00
Wolfgang Stöggl f037e7ef45 Fix typos found by codespell
- Typos were found by codespell v1.16.0
2019-11-06 09:55:30 -05:00
Jussi Pakkanen f2e018c7f3 Create multiple different archive types with dist. 2019-07-23 23:26:46 +03:00
Jussi Pakkanen 7ce2a24f42 Made dist a top level command. 2019-07-23 23:26:46 +03:00
Daniel Mensinger e75211d321
Fix builtin variable names 2019-04-29 12:17:40 +02:00
Dylan Baker 5678468c2c Don't use len() to test for container emptiness
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-25 12:28:51 -07:00
Dylan Baker add821db64 Don't use mutable types as default arguments
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-23 02:03:19 +03:00
Jussi Pakkanen 4e4f97edb3 Can run argument strings with internal Python. Closes #5217. 2019-04-21 15:14:34 +03:00
Jussi Pakkanen ee863d33c1
Merge pull request #2601 from 1ace/feature/completion
Add completion scripts for Bash and Zsh
2019-03-04 18:40:13 +02:00
Daniel Mensinger 90b557e38a
rewriter: Remove command alias 2019-03-04 13:00:07 +01:00
Daniel Mensinger 9874ce81f0
rewriter: make flake8 happy 2019-03-04 13:00:06 +01:00
Daniel Mensinger c4708c28f2
better formating of the help output 2019-03-04 13:00:06 +01:00
Eric Engestrom b758f0a953 add note to keep completion scripts updated 2019-02-20 18:48:39 +00:00
Andrei Alexeyev 51dadb92d0 runpython: insert script's dir into import path
Fixes #4947
2019-02-18 22:09:32 +02:00
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