aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib
AgeCommit message (Collapse)AuthorFilesLines
2021-07-07resolve symlinks passed to -CPaolo Bonzini1-0/+13
"meson setup" is resolving symlinks for the build directory in validate_core_dirs. For consistency with it, do the same when the build directory is passed via -C to devenv, dist, init, install and test. This ensures for example that the path to test dependencies is computed correctly in "meson test". Fixes: #8765
2021-07-05condense linesEli Schwartz1-6/+3
2021-07-05more f-strings too complex to be caught by pyupgradeEli Schwartz1-17/+17
2021-06-29fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger3-5/+5
2021-06-26refactor: Refactor BothLibraries logicDaniel Mensinger1-0/+9
This commit introduces a new type of `HoldableObject`: The `SecondLevelHolder`. The primary purpose of this class is to handle cases where two (or more) `HoldableObject`s are stored at the same time (with one default object). The best (and currently only) example here is the `BothLibraries` class.
2021-06-25Split compiler detection from EnvironmentDaniel Mensinger1-0/+44
This moves all the compiler detection logic into the new compilers.detect module. This dramatically reduces the size and complexity of Environment.
2021-06-22mesonlib: add rsplit and and maxsplitDylan Baker1-2/+5
Since string has a maxsplit as well, we should implement that for polymorphism
2021-06-22mesonlib: Fix FileMode type annotationsDylan Baker1-2/+2
2021-06-18holders: remove unholderDaniel Mensinger1-21/+0
2021-06-18holders: Introduce HoldableObjectDaniel Mensinger1-1/+7
2021-06-18mesonlib: Add MesonBugExceptionDaniel Mensinger1-0/+9
2021-06-05typing: Fully annotate dependencies.cudaDaniel Mensinger1-1/+1
2021-06-02use an immutable list for an lru_cached functionsDylan Baker1-1/+2
When mutable items are stored in an lru cache, changing the returned items changes the cached items as well. Therefore we want to ensure that we're not mutating them. Using the ImmutableListProtocol allows mypy to find mutations and reject them. This doesn't solve the problem of mutable values inside the values, so you could have to do things like: ```python ImmutableListProtocol[ImmutableListProtocol[str]] ``` or equally hacky. It can also be used for input types and acts a bit like C's const: ```python def foo(arg: ImmutableListProtocol[str]) -> T.List[str]: arg[1] = 'foo' # works while running, but mypy errors ```
2021-05-28Add a helper to simplify the usage of PerMachineDefaultableDylan Baker1-0/+15
2021-05-28mesonlib: Allow PerMachineDefaultable to take arguments at initializationDylan Baker1-2/+2
2021-05-28mesonlib: Fix return type of PerMachineDefaultable.default_missing()Dylan Baker1-1/+1
2021-05-19.C files are now treated as C++ codeVolker-Weissmann1-4/+6
2021-05-03Clarify incorrect configuration format messageNellie Zhang1-3/+3
Print the path and line where the problem occurred to make it more clear what the error message means.
2021-03-26windows_proof_rmtree: Also retry os.chmod() partXavier Claessens1-2/+9
It looks like when Windows media scanner holds files we can't change their permission neither.
2021-03-16Update VS module version check.Jussi Pakkanen1-0/+6
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz1-21/+21
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-03Windows Subsystem for Linux can run .exe without mono interpreterXavier Claessens1-0/+3
Fixes: #8445
2021-02-18allow build.b_* optionsDylan Baker1-2/+1
These continue to be ignored as they always have, but no longer raise an error. Fixes: #8354
2021-02-17Environment: Fix passing envrionment variables CPPFLAGS and CFLAGSDylan Baker1-1/+0
Or other language flags that use CPPFLAGS (like CXXFLAGS). The problem here is actually rather simple, `dict.setdefault()` doesn't work like I thought it did, I thought it created a weak entry, but it actually is equivalent to: ```python if k not in dict: dict[k] = v ``` Instead we'll use an intermediate dictionary (a default dictionary actually, since that makes things a little cleaner) and then add the keys from that dict to self.options as applicable. Test case written by Jussi, Fix by Dylan Co-authored-by: Jussi Pakkanen Fixes: #8361 Fixes: #8345
2021-02-06mesonlib: Add better errormessage to typelistifyDylan Baker1-2/+2
2021-01-29Popen_safe: Fix stdout/stderr annotationXavier Claessens1-4/+4
2021-01-26Warn about .C and .H files (#8249)Volker-Weissmann1-0/+7
2021-01-23split mesonlib into a packageDylan Baker5-0/+2236
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.