summaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
AgeCommit message (Collapse)Author
2025-10-20Fix typos in authorship informationVlad-Stefan Harbuz
2025-10-04utils: merge per-platform utils into `platform.py`Dylan Baker
This allows us to simplify running mypy, as we can just mypy the entire utils module regardless of the platform we're using. As an added bonus, this means we open one less module.
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2022-09-28Move classes used by scripts to their own moduleXavier Claessens
Those classes are used by wrapper scripts and we should not have to import the rest of mesonlib, build.py, and all their dependencies for that. This renames mesonlib/ directory to utils/ and add a mesonlib.py module that imports everything from utils/ to not have to change `import mesonlib` everywhere. It allows to import utils.core without importing the rest of mesonlib.
2021-01-23split mesonlib into a packageDylan Baker
Currently mesonlib does some import tricks to figure out whether it needs to use windows or posix specific functions. This is a little hacky, but works fine. However, the way the typing stubs are implemented for the msvcrt and fnctl modules will cause mypy to fail on the other platform, since the functions are not implemented. To aleviate this (and for slightly cleaner design), I've split mesonlib into a pacakge with three modules. A universal module contains all of the platform agnositc code, a win32 module contains window specific code, a posix module contains the posix specific code, and a platform module contains no-op implementations. Then the package's __init__ file imports all of the universal functions and all of the functions from the approriate platform module, or the no-op versions as fallbacks. This makes mypy happy, and avoids `if`ing all over the code to switch between the platform specific code.
2021-01-13Fix misspellsAntonin Décimo
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2021-01-04fix LGTM warningsDylan Baker
2021-01-04use OptionKey for builtin and base optionsDylan Baker
I would have prefered to do these seperatately, but they are combined in some cases, so it was much easier to convert them together. this eliminates the builtins_per_machine dict, as it's duplicated with the OptionKey's machine parameter.
2021-01-04move OptionKey to mesonlibDylan Baker
There's starting to be a lot of things including coredata that coredata needs to itself include. putting it in mesonlib makes more sense
2021-01-04Add choices to OptionProxyDylan Baker
they're probably not strictly needed, but it makes mypy happy.
2020-12-27mtest: add progress reportPaolo Bonzini
Add a progress report in the style of "yum". Every second the report prints a different test among the ones that are running. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-13Scan all C++ sources and ignore everything else.Jussi Pakkanen
2020-11-23Add a variant of TemporaryDirectory that uses windows_proof_rmtree()Christoph Reiter
Adds TemporaryDirectoryWinProof which calls windows_proof_rmtree() on error. Use instead of hacky error handling (which might shadow other OSError) in Compiler.compile().
2020-11-22Merge pull request #8010 from dcbaker/submit/optinterpreter-cleanupsJussi Pakkanen
Opt Interpreter cleanups and type annotations
2020-11-20Delete now dead < python 3.6 checkDylan Baker
2020-11-20use real pathlib moduleDylan Baker
We added the _pathlib module to work around defeciencies in python 3.5's implementation, since we now rely on 3.6 lets drop this
2020-11-20Allow setting attributes in MesonException intializerDylan Baker
Instead of forcing them to be set afterwards
2020-10-04pathlib: Fix resolve() by overriding it in Python 3.5Daniel Mensinger
2020-10-04cmake: switch to pathlib (fixes #7322)Daniel Mensinger
2020-10-01mesonlib: make OptionOverrideProxy a true MutableMappingDylan Baker
So that we can actually use it anyplace that an OptionDictType could be used. I've also done a bit optimizing/simplifying of the implementation. This is needed for cuda, as it returns an OptionOverrideProxy where we ask for an OptionDicType
2020-09-24compilers/compilers: Fully type annotateDylan Baker
2020-09-22pylint: turn on bad-indentation errorDylan Baker
and fix all of the bad indentation
2020-09-13external-project: New module to build configure/make projectsXavier Claessens
This adds an experimental meson module to build projects with other build systems. Closes: #4316
2020-09-10git: Use Popen_safe to avoid encoding issuesXavier Claessens
2020-09-10Move verbose_git() and quiet_git() to mesonlibXavier Claessens
2020-09-10mesonlib: Move MesonException declaration to the topXavier Claessens
2020-09-08typing: Fix code reviewDaniel Mensinger
2020-09-08typing: fix code reviewDaniel Mensinger
2020-09-08typing: fix dependencies for new follow_importsDaniel Mensinger
2020-09-08typing: fully annotate mesonlib.pyDaniel Mensinger
2020-08-30Be stricter when detecting Windows/CygwinChristoph Reiter
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 Pakkanen
Add AIX support
2020-08-18File: precompute hashPaolo Bonzini
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 Harris
Like the BSDs, AIX does not return anything useful in platform.machine().
2020-08-08Use uname -p to detect x86_64 on QNX.Elad Lahav
2020-08-01mesonlib: Add repr() methods to PerMachine classesDylan Baker
Which is super helpful in debuggers
2020-06-10Updated to resolve issue identifying SGI CPUs on IRIX systemsEric Dodd
2020-06-04mesonlib.py: refactored detect_vcs() to use pathlib.Path (#7230)Joshua Gawley
2020-05-14interpreter: Add always set default value for version and set it ASAPDylan Baker
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 Mensinger
2020-04-10Recognize Hurd as platform/OSPino Toscano
2020-04-10cmake: support cmake config file syntax (#6917)dabrain34
* 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 sourcesClausKlein
changes acording review comments
2020-03-19Use os.path.normpath() for include pathsClausKlein
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 Baker
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 Baker
2020-03-05mesonlib: Replace unholder argument to listifyDylan Baker
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 Baker
2020-03-04mesonlib: Fix File.__eq__ to return NotImplementedDylan Baker
The implementation assumes another File, but doesn't properly guard that. Let's do that guarding.
2020-03-04mesonlib: Use textwrap.dedentDylan Baker
This is mostly just to help folding editors like vim, which get confused by the non-indented code. It also helps readability, IMHO.