aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
AgeCommit message (Collapse)AuthorFilesLines
2020-08-30Be stricter when detecting Windows/CygwinChristoph Reiter1-2/+2
This removes the check for "mingw" for platform.system(). The only case I know where "mingw" is return is if using a msys Python under a msys2 mingw environment. This combination is not really supported by meson and will result in weird errors, so remove the check. The second change is checking sys.platform for cygwin instead of platform.system(). The former is document to return "cygwin", while the latter is not and just returns uname(). While under Cygwin it uname() always starts with "cygwin" it's not hardcoded in MSYS2 and starts with the environment name. Using sys.platform is safer here. Fixes #7552
2020-08-25Merge pull request #7581 from peterh/aixJussi Pakkanen1-0/+3
Add AIX support
2020-08-18File: precompute hashPaolo Bonzini1-1/+4
Most files are going to be looked up into a set or dictionary. Precompute the hash so that we only need to do so once and we can also use it to quickly weed out unequal objects. On a QEMU build, the time spent in __eq__ and __hash goes respectively from 3.110s to 2.162s and from 0.648s to 0.299s. Even larger gains are obtained by the next patch.
2020-08-12aix: fix cpu family detectionPeter Harris1-0/+3
Like the BSDs, AIX does not return anything useful in platform.machine().
2020-08-08Use uname -p to detect x86_64 on QNX.Elad Lahav1-0/+2
2020-08-01mesonlib: Add repr() methods to PerMachine classesDylan Baker1-0/+12
Which is super helpful in debuggers
2020-06-10Updated to resolve issue identifying SGI CPUs on IRIX systemsEric Dodd1-1/+3
2020-06-04mesonlib.py: refactored detect_vcs() to use pathlib.Path (#7230)Joshua Gawley1-7/+11
2020-05-14interpreter: Add always set default value for version and set it ASAPDylan Baker1-1/+3
Ideally we wouldn't need to have the default dict here and could just rely on it being set as soon as project is called. There is a corner case exercised by test case common/35 run program, which is that if a FeatureNew or FeatureDeprecated is called to generate the meson version it will be unset, to work around this I've changed the type from a dict to a default dict with '' as the default value. A better fix would probably be to store all of the FeatureNew/FeatureDeprecated checks until the end, then evaluate them, but for now this results in no loss of functionality, only more functionality, even if it isn't prefect.
2020-05-14boost: Try finding libraries with the matching arch (fixes #7110)Daniel Mensinger1-0/+10
2020-04-10Recognize Hurd as platform/OSPino Toscano1-0/+4
2020-04-10cmake: support cmake config file syntax (#6917)dabrain341-13/+47
* cmake: enhance support of cmake config file syntax Enhance the cmakedefine support by accepting 2 or 3 tokens in the conf line as mesondefine supports strictly 2 tokens * fixup! cmake: enhance support of cmake config file syntax * fixup! fixup! cmake: enhance support of cmake config file syntax
2020-03-19Remove my notes from sourcesClausKlein1-2/+0
changes acording review comments
2020-03-19Use os.path.normpath() for include pathsClausKlein1-0/+2
This make relative pathes shorter an too give a chance to de-duplicate -isystem flags just like -I flags. Fix common test case 203 for OSX build host too
2020-03-05remove ability to pass multiple keys to extract_as_listDylan Baker1-9/+2
This makes the typing annotations basically impossible to get right, but if we only have one key then it's easy. Fortunately python provides comprehensions, so we don't even need the ability to pass multiple keys, we can just [extract_as_list(kwargs, c) for c in ('a', 'b', 'c')] and get the same result.
2020-03-05mesonlib: use mlog instead of printDylan Baker1-2/+2
2020-03-05mesonlib: Replace unholder argument to listifyDylan Baker1-14/+5
listify shouldn't be unholdering, it's a function to turn scalar values into lists, or flatten lists. Having a separate function is clearer, easier to understand, and can be run recursively if necessary.
2020-03-05mesonbuild/mesonlib: Add type annotationsDylan Baker1-120/+225
2020-03-04mesonlib: Fix File.__eq__ to return NotImplementedDylan Baker1-0/+2
The implementation assumes another File, but doesn't properly guard that. Let's do that guarding.
2020-03-04mesonlib: Use textwrap.dedentDylan Baker1-4/+7
This is mostly just to help folding editors like vim, which get confused by the non-indented code. It also helps readability, IMHO.
2020-03-02types: Remove redundant __init__() -> None annotationDaniel Mensinger1-2/+2
2020-02-28Remove unused MesonException.get_msg_with_context()Jon Turney1-17/+0
After that, the only remaining user of get_error_location_string() is mlog, so move that there.
2020-02-16Popen_safe: Always re-setup the console colorsNirbheek Chauhan1-4/+9
2020-02-16Split console colourization into a separate functionNirbheek Chauhan1-2/+1
Use it instead of making a direct call to mlog._windows_ansi().
2020-02-16mesonlib: Set stdin to DEVNULL for all programs run by usNirbheek Chauhan1-0/+4
Otherwise there's a high likelihood that some program run by us will mess up the console settings and break ANSI colors. F.ex., running `uname` in the Visual Studio 2019 x86 developer prompt using `run_command()` does this.
2020-02-05add meson.get_native_property for native filesMichael Hirsch, Ph.D1-1/+1
This allows Meson native-file [properties] to be used. This avoids the need to call meson from a script file or have a long command line invocation of `meson setup` The method meson.get_native_property('prop', 'fallback') is added. The native file can contain properties like ``` [properties] myprop1 = 'foo' mydir2 = 'lib/custom' ``` Then from within `meson.build` ```meson x1 = meson.get_native_property('myprop1') thedir = meson.get_native_property('mydir2', 'libs') ``` fallback values are optional
2020-01-22Move git helper out into mesonlib for reuseNirbheek Chauhan1-0/+14
Reuse the git helper for `meson wrap` and `meson subprojects` so we don't need to maintain the same git-colors-on-windows workarounds in multiple places.
2020-01-08types: Fix/ignore flake8 B014/F811Daniel Mensinger1-2/+2
2020-01-08types: import typing as T (fixes #6333)Daniel Mensinger1-33/+33
2019-12-09cmake: add project language to cmakelists.txtMichael Hirsch, Ph.D1-1/+3
cmake: get language from Meson project if not specified as depedency(..., langugage: ...) deps: add threads method:cmake dependency('threads', method: 'cmake') is useful for cmake unit tests or those who just want to find threads using cmake. cmake: project(... Fortran) generally also requires C language
2019-12-05lgtm: ignore Iterator does not return self from __iter__ methodDaniel Mensinger1-2/+8
2019-11-28Revert "Have set() and set_quoted() of configuration object work with newlines."Xavier Claessens1-2/+0
This reverts commit 6ed36e97aeb01dd779115a9710d3a97cdbcb4ccf.
2019-11-25dep: MPI make work for intel-cl and improve robustnessMichael Hirsch, Ph.D1-1/+1
optimize intelMPI variables mpi: extract version from non-OpenMPI wrapper
2019-11-19Have set() and set_quoted() of configuration object work with newlines.Jehan1-0/+2
* Have set() and set_quoted() of configuration object work with newlines. set_quoted() makes the value into a double-quoted string, so let's assume C-style string, in particular with newlines as "\n". Also take care of remaining newlines in dump_conf_header(). C or nasm macros expect single-line values so if the value was multi-line, we would end up with broken syntax. Appending a backslash at each end of line make them concat into a single line in both C and nasm format (note: multi-line macros in nasm are actually possible apparently but use another format not outputted by current meson code). Also note that the replacement is done at the end only when dumping the conf as a header because we cannot assume anything about the format when replacing variables from an input file (in this case, it should be the dev responsibility). * Add unit tests for multiline set() and set_quoted().
2019-11-06Fix typos found by codespellWolfgang Stöggl1-4/+4
- Typos were found by codespell v1.16.0
2019-11-05dependency('cuda')Aleksey Gurtovoy1-0/+7
2019-10-22ducking 'None' for missing moduleMichael Hirsch, Ph.D1-2/+2
This handles the Windows-specific case, the next commit handles the general issue
2019-09-25Add helper to print warnings onceZbigniew Jędrzejewski-Szmek1-1/+14
The helper is general, although in this patch it is only used for warnings. No functional change intended.
2019-09-24CUDA support on WindowsAleksey Gurtovoy1-0/+30
2019-09-13get_library_dirs: Add Solaris 64-bit library subdirsAlan Coopersmith1-0/+8
Solaris puts 32-bit libraries in the main /lib & /usr/lib directories and 64-bit libraries in platform specific subdirectories. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-09-05mesonlib.split_args/quote_arg/join_argsAleksey Gurtovoy1-1/+79
2019-08-24wine: Try to get the short paths when generating WINEPATHThibault Saunier1-0/+34
The size of WINEPATH is limited (1024 [until recently]), we can very easily reach that limit, and even the new one (2048) so try to keep path as small as possible by using the shortPath version of paths. Also assert that we do not reach the new hard limit. And avoid having duplicates in the list of path. [until recently]: https://bugs.winehq.org/show_bug.cgi?id=45810
2019-08-23Support NetBSD aarch64 and earm.nia1-0/+3
2019-08-17Only iterate over existing libdirs.Jussi Pakkanen1-2/+6
2019-07-23mesonlib: Annotate Popen_safe functionsDylan Baker1-4/+11
These are used in linkers.py and need to be annotated to make linkers.py 100% clean
2019-07-20Add optional progress bar when generating build.ninjaNirbheek Chauhan1-0/+55
2019-07-08type hints @dcbakerMichael Hirsch, Ph.D1-6/+5
2019-07-08add clang c_std=c18 aliasMichael Hirsch, Ph.D1-3/+3
fix unit test skips for clang c18 correct unittests clang minimum version cleanup unittest clang skip c_std finesse unittest vs. clang version
2019-06-09remove `for_XXX` functions from mesonlibJohn Ericson1-70/+0
All uses now use `env.machines.YYY.is_XXX` instead.
2019-06-09Use `env.machines.*` to avoid some `is_cross`John Ericson1-39/+21
This is a small example of the `is_cross` removal the that abstraction enables.