Commit Graph

107 Commits

Author SHA1 Message Date
Robin c2f062a02e Fix encoding bug on Windows 2018-04-14 21:56:24 +03:00
David Fort 6dea177774 add support for cmakedefine in configure_file()
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.
2018-04-08 22:00:45 +03:00
Jussi Pakkanen 58156ef7cf Grab a file lock on the build dir during modifications. 2018-03-20 22:28:37 +02:00
Nirbheek Chauhan d012b5b997 Create a helper for checking if a string has a path component
This is used in a number of places, and in some places it is incomplete.
Use a helper to ensure it's used properly.
2018-03-19 23:45:43 +02:00
Mathieu Duponchelle 9f7bdedc94 mesonlib: fix meson detection (again)
Starting from 8fc4244187, 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.
2018-03-07 19:56:24 +02:00
Nirbheek Chauhan aeee01f639 rmtree: Don't retry when the file is not found
No need to pointlessly loop for several seconds in this case.
2018-02-20 00:19:11 +02:00
Nirbheek Chauhan 657d9f2b29 Support running out-of-tree tests against a meson in PATH
Closes https://github.com/mesonbuild/meson/issues/3015
2018-02-20 00:17:18 +02:00
Robert Bragg 6f510ca695 Don't version shared libraries for Android
Android's loader doesn't handle shared library versioning so this avoids
adding a suffix to the filename or soname for Android hosts.
2018-02-04 00:49:16 +02:00
Aleksey Filippov 2cf85ae16f Use os.path: basename() and dirname() instead of split()
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
2018-01-30 07:08:22 +11:00
Salamandar 93ba30751e dump_conf_header should rewrite file only if modified (just like do_conf_file) (#2952) 2018-01-30 06:33:38 +11:00
Jussi Pakkanen dfd368d405
Merge pull request #2803 from dcbaker/wip/freebsd-fixes
various BSD fixes
2018-01-09 22:08:00 +02:00
Jussi Pakkanen 392b3d8bc7
Merge pull request #2840 from alyst/fix_detect_location
Fix meson location detection from other meson tools
2018-01-07 19:27:19 +02:00
Dylan Baker 660dee1e10 LLVM: use DragonFly BSD workaround on FreeBSD as well 2018-01-06 13:49:34 -08:00
Dylan Baker 10a560a411 compilers: fix unittest "16 prebuilt shared" on dragonfly bsd 2018-01-06 13:49:34 -08:00
Jussi Pakkanen 0538009d30 Bump minimum supported Python from 3.4 to 3.5. 2018-01-04 21:29:02 +02:00
Alexey Stukalov da44a93daa normpath to bundled meson executable
add comments clarifying when the 1st method of finding meson.py may fail
2018-01-03 14:58:30 +01:00
Alexey Stukalov 8fc4244187 fix meson location detection if run by wraptool
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
2018-01-03 14:58:09 +01:00
Benjamin Redelings c62078dae5 Add missing for_linux( ) function. 2018-01-01 22:42:49 -08:00
Jussi Pakkanen ff98407ade Dead code removal. 2017-12-21 21:06:17 +02:00
Jussi Pakkanen 164fb9a150 Also promote wrap files. 2017-12-17 21:19:22 +02:00
Jussi Pakkanen 5b9d79b902 Print instructions on how to promote subsubprojects. 2017-12-17 21:19:22 +02:00
Jussi Pakkanen 88756bfe95 Print UTF-8 warning only when actually encountering non-ascii filenames. 2017-12-14 23:49:12 +02:00
Dylan Baker fc547ad05e haiku: do not add pthread arguments
Haiku has pthreads, but they are part of the standard C library, and do
not need either special compiler or linker flags.
2017-12-07 09:35:12 -08:00
Jussi Pakkanen 112e6c1927
Merge pull request #2638 from jibsen/use-value-regex
Use regex to substitute template strings
2017-12-03 23:03:13 +02:00
Nirbheek Chauhan 91d8784a04 configure_file: Compare difference in binary mode
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.
2017-11-27 20:53:27 +02:00
Jussi Pakkanen 4ca1e8638c Fix running tests when there is a period in PATH. 2017-11-27 01:35:27 +02:00
Joergen Ibsen 91a0126590 Improve escaping in configuration files
Replace pairs of backslashes before '@' or '\@' with singles (allows
escaping the escape character). Do not consume next '@' after '\@'.
2017-11-26 13:21:21 +02:00
Jussi Pakkanen 247d632f37 Try harder to find meson.py. Closes #2672. 2017-11-23 20:48:44 +02:00
Joergen Ibsen f31142de88 Use regex to substitute template strings 2017-11-22 10:55:35 +01:00
Jussi Pakkanen d882b6fbd4
Merge pull request #2498 from mesonbuild/runpython
Add possibility to run Python scripts with current interpreter
2017-11-22 00:47:20 +02:00
Joergen Ibsen fdb48a3a0f Use re.sub instead of replace loop
This also prohibits recursive substitution.
2017-11-22 00:43:32 +02:00
Jussi Pakkanen 22adda1617 Review fixes. 2017-11-21 23:29:06 +02:00
Jussi Pakkanen 9d67e5030b Changed code to use detected executables rather than hardcoding sys.executable. 2017-11-20 23:08:17 +02:00
Nirbheek Chauhan d2a250412c compilers: Improve manual library searching
We can now specify the library type we want to search for, and whether
we want to prefer static libraries over shared ones or the other way
around. This functionality is not exposed to build files yet.
2017-11-11 23:06:48 +05:30
Nirbheek Chauhan bb0e18b738 Use listify and extract_as_list everywhere
They now flatten by default and unhold objects if required

Includes unit tests.
2017-10-01 22:27:48 +05:30
Nirbheek Chauhan 24e0774ace Always flatten in listify() since we always want that
All our kwargs take lists that must be flattened

Closes https://github.com/mesonbuild/meson/issues/2408
2017-10-01 12:18:57 +05:30
Jussi Pakkanen 898b723ee5 Merge pull request #2331 from mesonbuild/winencode
Do not use universal newlines on old Python versions.
2017-09-19 22:05:11 +03:00
Alexis Jeandet bf64cf569b Gnome, pkgconfig, Qt4, Qt5 and windows modules slightly refactored.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-09-18 22:21:22 +02:00
Alexis Jeandet 55975f852e Introduced extract_as_list.
Corrected code style and typo.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-09-18 22:21:22 +02:00
Alexis Jeandet 7549a39a17 Introduction of listify method. Test on build.py module to see benefits.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-09-18 22:21:22 +02:00
Jussi Pakkanen df18c1ac98 Do not use universal newlines on old Python versions. 2017-09-18 20:33:07 +03:00
Jérôme Duval 0b8db94065 Add is_haiku(), needed for run_tests.py. 2017-09-14 00:11:17 +03:00
Nirbheek Chauhan b3c70f495b interpreter: Always flatten when unholding arrays
Otherwise we might end up with wrapper holders in the Build object and
pickling will then fail, defeating the purpose of the holder objects.

Closes https://github.com/mesonbuild/meson/issues/2211
2017-09-11 23:50:12 +03:00
Michal Koutný e94a9c8fcf Allow version labels with trailing dots
Fixes #1586
2017-09-04 19:26:57 +03:00
Jussi Pakkanen 50fb7d37ab Make all functionality invokable via the main Meson binary,
which can be a Windows .exe file.
2017-08-18 12:08:20 +03:00
Christoph Reiter ceea746222 configure_file: warn in case a variable to subsitute is not present in the passed configuration. Fixes #2090 2017-07-21 20:11:50 +03:00
Jussi Pakkanen ad3dc937f1 Fix remaining Interpreter object leaks. 2017-07-01 02:10:02 +03:00
Jussi Pakkanen c11a4cb952 Make Interpreter object unpicklable as it was being pickled by accident in copies of kwargs. 2017-07-01 00:11:27 +03:00
Jussi Pakkanen effe4fb134 Create helper function for a rmtree that works reliably on Windows. 2017-05-21 21:47:24 +03:00
Dylan Baker e419198ff8 Flatten should always return a list
Currently if flatten() is passed a non-list object, it returns that
object. This is surprising behavior, and prone to causing serious and
numerous problems, since many objects implement the iterable interface,
and thus can be used in cases a list is expected, but with undesirable
results.
2017-05-11 09:57:38 -07:00