summaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix searching of shared libraries on OpenBSD (#3851)Nirbheek Chauhan2018-07-091-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * get_library_naming: Use templates instead of suffix/prefix pairs This commit does not change functionality, and merely sets the groundwork for a more flexibly naming implementation. * find_library: Fix manual searching on OpenBSD On OpenBSD, shared libraries are called libfoo.so.X.Y where X is the major version and Y is the minor version. We were assuming that it's libfoo.so and not finding shared libraries at all while doing manual searching, which meant we'd link statically instead. See: https://www.openbsd.org/faq/ports/specialtopics.html#SharedLibs Now we use file globbing to do searching, and pick the first one that's a real file. Closes https://github.com/mesonbuild/meson/issues/3844 * find_library: Fix priority of library search in OpenBSD Also add unit tests for the library naming function so that it's absolutely clear what the priority list of naming is. Testing is done with mocking on Linux to ensure that local testing is easy
* Print a more usable message when a subproject fails to configureNirbheek Chauhan2018-07-071-0/+10
| | | | | | | Instead of just printing the message in the exception, if it's a MesonException, also print the file and the line number. If it's an unknown exception, print the entire traceback so that we can pin-point what the Meson bug causing it is.
* Raise a MesonException when substituting an invalid valueNirbheek Chauhan2018-07-071-1/+3
| | | | Avoids throwing a traceback. Also, warn when setting such a value.
* configure_file: Don't optimize away substitutionsNirbheek Chauhan2018-07-041-1/+7
| | | | | | | | | | | It's possible that the configuration data object has components added conditionally, and that sometimes an empty configuration data object is passed on purpose. Instead, we do the substitution and also warn if no tokens were found that could've been substituted. Closes https://github.com/mesonbuild/meson/issues/3826
* FeatureNew: Make all checks subproject-specificNirbheek Chauhan2018-07-021-2/+2
| | | | | | | | | | | | We now pass the current subproject to every FeatureNew and FeatureDeprecated call. This requires a bunch of rework to: 1. Ensure that we have access to the subproject in the list of arguments when used as a decorator (see _get_callee_args). 2. Pass the subproject to .use() when it's called manually. 3. We also can't do feature checks for new features in meson_options.txt because that's parsed before we know the meson_version from project()
* Various bug fixes for FeatureNewSalamandar2018-07-021-9/+18
| | | | | | | | | | | | | | | | | * Use _get_callee_args to unwrap function call arguments, needed for module functions. * Move some FeatureNewKwargs from build.py to interpreter.py * Print a summary for featurenew only if conflicts were found. The summary now only prints conflicting features. * Report and store featurenew/featuredeprecated only once * Fix version comparison: use le/ge and resize arrays to not fail on '0.47.0>=0.47' Closes https://github.com/mesonbuild/meson/issues/3660
* run_command: Add new kwarg 'capture'Nirbheek Chauhan2018-06-181-9/+6
| | | | | | capture: false means we won't try to read the stdout at all. Closes https://github.com/mesonbuild/meson/issues/3364
* Add file encoding to configure_fileSander Sweers2018-06-091-4/+7
| | | | | | Input files can be in any file encoding, not just utf-8 or isolatin1. Meson should not make assumptions here and allow for the user to specify the encoding to use.
* Fix #mesondefine token error message formattingMarvin Scholz2018-06-031-1/+1
|
* Make windows_proof_rmtree resilient to read-only filesFilipe Brandenburger2018-06-021-0/+13
| | | | | | | | | | Start the process by traversing the tree and adding the S_IWRITE and S_IREAD bits to the file's mode (which are also preserved on Windows.) This fixes windows_proof_rmtree's inability to remove read-only files, which was uncovered in testing the new `install_mode` feature. Tested: ./run_tests.py passes on Linux, appveyor CI on Windows passes.
* Merge pull request #3486 from Salamandar/salamandar/meson_version_introspectionJussi Pakkanen2018-06-011-0/+70
|\ | | | | Add FeatureNew and FeatureDeprecated, to alert the user of bad meson_version
| * Move target_version from coredata to mesonlibSalamandar2018-06-011-0/+2
| |
| * Add version_compare_condition_with_{min,max} for specific comparison utils.Salamandar2018-06-011-0/+68
| | | | | | | | | | Split FeatureNew and FeatureDeprecated Implement features report to be printed in some 'dev mode'
* | Set the meson command to use when we know what it isNirbheek Chauhan2018-06-011-47/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | configure_file: Add output_format kwarg (#3636)Mathieu Duponchelle2018-06-011-9/+27
|/ | | | | | * configure_file: Add output_format kwarg * docs: Reference-manual.md output_format was added in 0.47 [skip ci]
* Revert "mesonlib: handle meson exe wrappers"Nirbheek Chauhan2018-05-311-1/+47
| | | | | | | | This reverts commit 0627e9d616dc311b7c9b0ef17301f680ac9e78a7. Breaks installation: https://github.com/mesonbuild/meson/issues/3647 Will be restored once that can be fixed.
* mesonlib: handle meson exe wrappersMartin Kelly2018-05-301-47/+1
| | | | | | | | | | | | | | | | | | | | 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.
* for_darwin: Also accept system='ios' in cross filesNirbheek Chauhan2018-05-211-1/+1
|
* add linker flag to handle $ORIGIN on OpenBSDJasper Lievisse Adriaanse2018-05-041-0/+3
|
* Fix encoding bug on WindowsRobin2018-04-141-1/+3
|
* add support for cmakedefine in configure_file()David Fort2018-04-081-7/+22
| | | | | | | The added format argument for configure_file allows to specify the kind of file that is treated. It defaults to 'meson', but can also have the 'cmake' or 'cmake@' value to treat config.h.in files in the cmake format with #cmakedefine statements.
* Grab a file lock on the build dir during modifications.Jussi Pakkanen2018-03-201-0/+38
|
* Create a helper for checking if a string has a path componentNirbheek Chauhan2018-03-191-0/+6
| | | | | This is used in a number of places, and in some places it is incomplete. Use a helper to ensure it's used properly.
* mesonlib: fix meson detection (again)Mathieu Duponchelle2018-03-071-5/+4
| | | | | | | | | | Starting from 8fc424418720da4ef61bde9348f4cc1a149d1cb2, tests failed on my system (python 3.6 arch) because shutil.which('meson.py') returns 'meson.py', not './meson.py'. Refactor that codepath by using os.path.isabs instead of "m_dir == '.'", also remove the adjacent comment because it doesn't make much sense.
* rmtree: Don't retry when the file is not foundNirbheek Chauhan2018-02-201-0/+2
| | | | No need to pointlessly loop for several seconds in this case.
* Support running out-of-tree tests against a meson in PATHNirbheek Chauhan2018-02-201-5/+11
| | | | Closes https://github.com/mesonbuild/meson/issues/3015
* Don't version shared libraries for AndroidRobert Bragg2018-02-041-0/+15
| | | | | Android's loader doesn't handle shared library versioning so this avoids adding a suffix to the filename or soname for Android hosts.
* Use os.path: basename() and dirname() instead of split()Aleksey Filippov2018-01-301-3/+3
| | | | | | | | | | | | According to Python documentation[1] dirname and basename are defined as follows: os.path.dirname() = os.path.split()[0] os.path.basename() = os.path.split()[1] For the purpose of better readability split() is replaced by appropriate function if only one part of returned tuple is used. [1]: https://docs.python.org/3/library/os.path.html#os.path.split
* dump_conf_header should rewrite file only if modified (just like ↵Salamandar2018-01-301-1/+3
| | | | | | do_conf_file) (#2952)
* Merge pull request #2803 from dcbaker/wip/freebsd-fixesJussi Pakkanen2018-01-091-0/+6
|\ | | | | various BSD fixes
| * LLVM: use DragonFly BSD workaround on FreeBSD as wellDylan Baker2018-01-061-0/+3
| |
| * compilers: fix unittest "16 prebuilt shared" on dragonfly bsdDylan Baker2018-01-061-0/+3
| |
* | Merge pull request #2840 from alyst/fix_detect_locationJussi Pakkanen2018-01-071-18/+29
|\ \ | |/ |/| Fix meson location detection from other meson tools
| * normpath to bundled meson executableAlexey Stukalov2018-01-031-1/+5
| | | | | | | | add comments clarifying when the 1st method of finding meson.py may fail
| * fix meson location detection if run by wraptoolAlexey Stukalov2018-01-031-16/+23
| | | | | | | | | | | | | | | | teach detect_meson_py_location() that meson.py is not the only one meson executable (there's wraptool + legacy scripts) that could be installed to the PATH folder fixes #2810
* | Bump minimum supported Python from 3.4 to 3.5.Jussi Pakkanen2018-01-041-25/+0
| |
* | Add missing for_linux( ) function.Benjamin Redelings2018-01-011-0/+12
|/
* Dead code removal.promotedepJussi Pakkanen2017-12-211-9/+0
|
* Also promote wrap files.Jussi Pakkanen2017-12-171-6/+11
|
* Print instructions on how to promote subsubprojects.Jussi Pakkanen2017-12-171-0/+29
|
* Print UTF-8 warning only when actually encountering non-ascii filenames.Jussi Pakkanen2017-12-141-0/+29
|
* haiku: do not add pthread argumentsDylan Baker2017-12-071-0/+12
| | | | | Haiku has pthreads, but they are part of the standard C library, and do not need either special compiler or linker flags.
* Merge pull request #2638 from jibsen/use-value-regexJussi Pakkanen2017-12-031-5/+4
|\ | | | | Use regex to substitute template strings
| * Use regex to substitute template stringsJoergen Ibsen2017-11-221-5/+4
| |
* | configure_file: Compare difference in binary modeNirbheek Chauhan2017-11-271-1/+1
| | | | | | | | | | | | Otherwise Python will try to use string decode on the configured file and fail if it contains characters that can't be mapped to the current encoding.
* | Fix running tests when there is a period in PATH.Jussi Pakkanen2017-11-271-1/+7
| |
* | Improve escaping in configuration filesJoergen Ibsen2017-11-261-13/+22
| | | | | | | | | | Replace pairs of backslashes before '@' or '\@' with singles (allows escaping the escape character). Do not consume next '@' after '\@'.
* | Try harder to find meson.py. Closes #2672.Jussi Pakkanen2017-11-231-1/+23
|/
* Merge pull request #2498 from mesonbuild/runpythonJussi Pakkanen2017-11-221-0/+9
|\ | | | | Add possibility to run Python scripts with current interpreter
| * Review fixes.Jussi Pakkanen2017-11-211-2/+2
| |