summaryrefslogtreecommitdiff
path: root/mesonbuild/mesonmain.py
Commit message (Collapse)AuthorAgeFilesLines
...
| * i18n: Add data_dirs kwarg to merge_file()Patrick Griffis2017-04-291-0/+3
| | | | | | | | | | | | For parity with gettext() Fixes #1565
* | Expand input paths so they do not contain symlinks.Jussi Pakkanen2017-05-021-2/+2
| |
* | Don't use len() to test emptiness vs not emptinessDylan Baker2017-05-021-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Meson has a common pattern of using 'if len(foo) == 0:' or 'if len(foo) != 0:', however, this is a common anti-pattern in python. Instead tests for emptiness/non-emptiness should be done with a simple 'if foo:' or 'if not foo:' Consider the following: >>> import timeit >>> timeit.timeit('if len([]) == 0: pass') 0.10730923599840025 >>> timeit.timeit('if not []: pass') 0.030033907998586074 >>> timeit.timeit('if len(['a', 'b', 'c', 'd']) == 0: pass') 0.1154778649979562 >>> timeit.timeit("if not ['a', 'b', 'c', 'd']: pass") 0.08259823200205574 >>> timeit.timeit('if len("") == 0: pass') 0.089759664999292 >>> timeit.timeit('if not "": pass') 0.02340641999762738 >>> timeit.timeit('if len("foo") == 0: pass') 0.08848102600313723 >>> timeit.timeit('if not "foo": pass') 0.04032287199879647 And for the one additional case of 'if len(foo.strip()) == 0', which can be replaced with 'if not foo.isspace()' >>> timeit.timeit('if len(" ".strip()) == 0: pass') 0.15294511600222904 >>> timeit.timeit('if " ".isspace(): pass') 0.09413968399894657 >>> timeit.timeit('if len(" abc".strip()) == 0: pass') 0.2023209120015963 >>> timeit.timeit('if " abc".isspace(): pass') 0.09571301700270851 In other words, it's always a win to not use len(), when you don't actually want to check the length.
* Make it possible to only do unity builds on subprojects.Jussi Pakkanen2017-04-151-1/+1
|
* Merge pull request #1516 from centricular/git-submodule-subprojectsJussi Pakkanen2017-03-251-0/+5
|\ | | | | Add support for using git submodules as subprojects
| * wrap: Implement special wrap modes for use by packagersNirbheek Chauhan2017-03-251-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Special wrap modes: nofallback: Don't download wraps for dependency() fallbacks nodownload: Don't download wraps for all subproject() calls Subprojects are used for two purposes: 1. To download and build dependencies by using .wrap files if they are not provided by the system. This is usually expressed via dependency(..., fallback: ...). 2. To download and build 'copylibs' which are meant to be used by copying into your project. This is always done with an explicit subproject() call. --wrap-mode=nofallback will never do (1) --wrap-mode=nodownload will do neither (1) nor (2) If you are building from a release tarball, you should be able to safely use 'nodownload' since upstream is expected to ship all required sources with the tarball. If you are building from a git repository, you will want to use 'nofallback' so that any 'copylib' wraps will be download as subprojects. Note that these options do not affect subprojects that are git submodules since those are only usable in git repositories, and you almost always want to download them.
* | add 'vs' backend that automatically chooses between the vs backendsNicolas Schneider2017-03-231-0/+4
| | | | | | | | | | | | | | | | | | For newer VS versions, we can simply rely on 'VisualStudioVersion' being set in the environment. For VS2010, we fall back to check 'VSINSTALLDIR' for the version string. If the backend can not be auto detected, we raise an exception to make the user choose an explicit backend. We also print the detected backend to the meson log.
* | add vs2017 backendNicolas Schneider2017-03-221-0/+3
|/ | | | | | VS2017 requires the 'WindowsTargetPlatformVersion' property to be set. We gather the version to use from the environment variable 'WindowsSDKVersion' that will be set by the VS developer command prompt.
* Force installation dir options to be inside prefixNirbheek Chauhan2017-01-231-9/+0
| | | | | | | | | | | | | | | | | | | With the exception of things like sysconfdir (/etc), every other installation directory option must be inside the prefix. Also move the prefix checks to coredata.py since prefix can also be set from inside project() with default_options and via mesonconf. Earlier you could set prefix to a relative path that way. This also allows us to return consistent values for get_option('xxxdir') regardless of whether relative paths are passed or absolute paths are passed while setting options on the command-line, via mesonconf, or via default_options in project(). Now the returned path will *always* be relative to the prefix. Includes a unit test for this, and a failing test. Closes #1299
* cleanup: Remove redundant parenthesesMike Sinkovsky2017-01-181-4/+4
|
* style: fix E202 violationsIgor Gnatenko2017-01-021-1/+1
| | | | | | E202: whitespace before ']' Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* style: fix E201 violationsIgor Gnatenko2017-01-021-1/+1
| | | | | | E201: whitespace after '[' Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* Add simple uninstall target. Closes #753.Jussi Pakkanen2016-12-311-0/+3
|
* Use a script to clean-up custom-target output dirsNirbheek Chauhan2016-12-191-0/+3
| | | | | | | | | The script will manually delete all custom_target outputs that are directories instead of files. This is needed because on platforms other than Windows, Ninja only deletes directories while cleaning if they are empty. Closes #1220
* add support for $sharedstatedirIgor Gnatenko2016-12-181-0/+1
| | | | Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* add support for $infodirIgor Gnatenko2016-12-181-0/+1
| | | | Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* add support for $sbindirIgor Gnatenko2016-12-181-0/+1
| | | | Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* add builtin support for localstatedirIgor Gnatenko2016-12-061-0/+1
| | | | | | Reported-by: Richard Hughes <richard@hughsie.com> Closes: https://github.com/mesonbuild/meson/issues/1142 Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
* Tell users about mesonconf if they try to run Meson on an existing build dir.Jussi Pakkanen2016-12-031-1/+3
|
* Don't show tracebacks for MesonException in helper scriptsSam Thursfield2016-11-261-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I hit an issue when building gtk-doc documentation. The issue is my fault, but the error output from Meson makes it look like an internal error: [0/1] 'Running external command libtracker-sparql-doc.' Building documentation for libtracker-sparql Traceback (most recent call last): File "/home/sam/meson/meson.py", line 26, in <module> sys.exit(main()) File "/home/sam/meson/meson.py", line 23, in main return mesonmain.run(launcher, sys.argv[1:]) File "/home/sam/meson/mesonbuild/mesonmain.py", line 249, in run sys.exit(run_script_command(args[1:])) File "/home/sam/meson/mesonbuild/mesonmain.py", line 239, in run_script_command return cmdfunc(cmdargs) File "/home/sam/meson/mesonbuild/scripts/gtkdochelper.py", line 183, in run options.ignore_headers.split('@@') if options.ignore_headers else []) File "/home/sam/meson/mesonbuild/scripts/gtkdochelper.py", line 133, in build_gtkdoc gtkdoc_run_check(mkhtml_cmd, os.path.join(abs_out, 'html')) File "/home/sam/meson/mesonbuild/scripts/gtkdochelper.py", line 55, in gtkdoc_run_check raise MesonException('\n'.join(err_msg)) mesonbuild.mesonlib.MesonException: 'gtkdoc-mkhtml' failed with status 6 warning: failed to load external entity "../overview.sgml" ../libtracker-sparql-docs.sgml:20: element include: XInclude error : could not load ../overview.sgml, and no fallback was found warning: failed to load external entity "../examples.sgml" ../libtracker-sparql-docs.sgml:41: element include: XInclude error : could not load ../examples.sgml, and no fallback was found FAILED: libtracker-sparql-doc After this patch, the output is much clearer: [0/1] 'Running external command libtracker-sparql-doc.' Building documentation for libtracker-sparql Error in gtkdoc helper script: 'gtkdoc-mkhtml' failed with status 6 warning: failed to load external entity "../overview.sgml" ../libtracker-sparql-docs.sgml:20: element include: XInclude error : could not load ../overview.sgml, and no fallback was found warning: failed to load external entity "../examples.sgml" ../libtracker-sparql-docs.sgml:41: element include: XInclude error : could not load ../examples.sgml, and no fallback was found Note the actual errors from xsltproc are swallowed by gtkdoc-mkhtml 1.25.1, they're only displayed in the example above because I made a patch: <https://bugzilla.gnome.org/show_bug.cgi?id=774812>
* All testing is now in mesontest.py, which simplifies a lot of stuff.Jussi Pakkanen2016-11-181-6/+0
|
* Create target directory if it does not exist. Closes #935.Jussi Pakkanen2016-11-091-0/+4
|
* Implement mlog.warning and use it everywhere for warningsNirbheek Chauhan2016-11-081-2/+2
| | | | | | Prepends the string with 'WARNING:' in ANSI yellow. Closes https://github.com/mesonbuild/meson/issues/961
* gnome: Add yelp() functionPatrick Griffis2016-10-191-0/+3
| | | | | Fixes #881 Mentioned in #295
* allow libdir/includedir/etc. be absolute pathsIgor Gnatenko2016-10-111-1/+1
| | | | | | | | | | | | In Fedora we don't care about prefix, we want to ensure that libdir is /usr/lib64, localedir is /usr/share/locale, and cetera. Additionally, we don't need to ensure that prefix is absolute as we check it in main. Fixes: cc19bf0f45f9 ("Move option validation in objects rather than doing it only in the conf script.") Closes: https://github.com/mesonbuild/meson/issues/869 Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* Show error log options in help.Jussi Pakkanen2016-10-101-0/+2
|
* Use argv[0] to internally relaunch meson.pyEmanuele Aina2016-10-081-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | When installing Meson, distutils may choose to put shim scripts in the `PATH` that only set up the egg requirements before launching the real `meson.py` contained in the egg. This means that `__file__` points to the real `meson.py` file, but launching it directly is doomed to fail as it's missing the metadata contained in the shim to set up the path egg, resulting in errors when trying to import the `mesonbuild` module. A similar issue affects Meson when installed as a zipapp, with the current code going great lengths to figure out how to relaunch itself. Using `argv[0]` avoids these issues as it gives us the way the current executable has been launched, so we are pretty much guaranteed that using it will create another instance of the same executable. We only need to resolve relative paths as the current working directory may get changed before re-launching the script, and using `realpath()` for that saves us the trouble of manually resolving links and getting caught in endless loops. This also mean that `meson_script_file` no longer necessarily point to a absolute file, so rename it to `_launcher` which hopefully would be less prone to inducing false assumptions.
* Remove shebangs on files that are not runnable and add execute bits to those ↵Jussi Pakkanen2016-10-071-2/+0
| | | | that are.
* Merge branch 'QuLogic-context-managers'Jussi Pakkanen2016-09-011-1/+2
|\
| * Use context manager for file I/O.Elliott Sales de Andrade2016-08-271-1/+2
| | | | | | | | | | There are a few cases where a context manager cannot be used, such as the logger.
* | Use argparse's builtin version printer.Elliott Sales de Andrade2016-08-301-5/+2
|/
* Added sysconfdir option. Closes #694.Jussi Pakkanen2016-08-211-0/+1
|
* vs: Fix regen_checker by using the correct coredata mtimeNirbheek Chauhan2016-07-291-2/+7
| | | | | | | | After c01b183e5, the mtime of coredata.dat is always newer than all the other build files, which made regen_checker think that they always had to be regenerated. Now we set the mtime of the file to a value before the build files are generated and that makes everything behave as it did earlier.
* Warn if PKG_CONFIG_PATH has changed because it may cause dependency ↵Jussi Pakkanen2016-07-151-0/+8
| | | | detection to fail. Closes #626.
* mesonmain: Dump the coredata lastNirbheek Chauhan2016-07-151-1/+6
| | | | | | | Otherwise we'll mark the build directory as successfully configured even if there's an error while doing the actual generation. Reported on IRC by 'sdgsgad'
* extract vs2015backend into own fileNicolas Schneider2016-05-301-2/+2
|
* add vs2015 backendNicolas Schneider2016-05-301-1/+3
|
* Merge pull request #479 from mesonbuild/i18nJussi Pakkanen2016-05-251-0/+3
|\ | | | | Moved gettext into i18n module.
| * Remove all special casing for gettext and use elementary operations instead.Jussi Pakkanen2016-05-211-0/+3
| |
* | Automagic scan-build support.Jussi Pakkanen2016-05-221-0/+3
| |
* | ninja: Set PATH for CustomTargets with built EXEs on WindowsNirbheek Chauhan2016-04-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a CustomTarget is run with a command that is an executable built by the project which also has a DLL built in the same project as a dependency, the EXE can't run on Windows because the DLL can't be found. On UNIX-like systems, we set the RPATH using the linker so these dependencies can be found, but on Windows the only way is to set the PATH environment variable. The same problem exists for tests, so we reuse that infrastructure by creating a new meson_exe.py script that can be used as a wrapper to run CustomTarget commands on Windows. This can later also be extended to add support for setting an environment while calling the command needed to generate a CustomTarget: https://github.com/mesonbuild/meson/issues/266
* | coredata: Centralize builtin option descriptions and definitions.Hemmo Nieminen2016-04-041-40/+30
| |
* | Move MesonException from coredata to mesonlib.Hemmo Nieminen2016-04-011-2/+2
|/
* Merge branch 'base_options'.Jussi Pakkanen2016-03-201-4/+0
|\
| * Converted precompiled headers into a base option.Jussi Pakkanen2016-03-201-2/+0
| |
| * Converted coverage into a base option.Jussi Pakkanen2016-03-201-2/+0
| |
* | New builtin option: libexecdir for installation of helper executablesNirbheek Chauhan2016-03-171-0/+2
|/
* Can add postconfigure script.Nicolas Schneider2016-03-011-0/+1
|
* dump coredata to file before calling backend.generate()Nicolas Schneider2016-02-251-1/+1
| | | | | | This ensures that all build files always have a later timestamp than coredata.dat, which is used to check if the build files must be regenerated.
* Merge pull request #358 from tp-m/no-argsJussi Pakkanen2016-02-241-8/+15
|\ | | | | Try harder to infer build and source directories if called without arguments.