summaryrefslogtreecommitdiff
path: root/mesonbuild/cmake
AgeCommit message (Collapse)Author
2023-09-11parser: preserve number baseCharles Brunet
2023-08-11treewide: automatic rewriting of all comment-style type annotationsEli Schwartz
Performed using https://github.com/ilevkivskyi/com2ann This has no actual effect on the codebase as type checkers (still) support both and negligible effect on runtime performance since __future__ annotations ameliorates that. Technically, the bytecode would be bigger for non function-local annotations, of which we have many either way. So if it doesn't really matter, why do a large-scale refactor? Simple: because people keep wanting to, but it's getting nickle-and-dimed. If we're going to do this we might as well do it consistently in one shot, using tooling that guarantees repeatability and correctness. Repeat with: ``` com2ann mesonbuild/ ```
2023-08-11remove useless type annotationsEli Schwartz
These annotations all had a default initializer of the correct type, or a parent class annotation.
2023-07-19cmake: fix empty BOOL generator expression evaluating to truekiwixz
2023-07-19cmake: find dependencies with bare library names on all platformskiwixz
2023-06-26WIP: cmake: do not re-export unused top-level objectsEli Schwartz
We should try to figure out what is a cross-submodule object and what isn't.
2023-05-03cmake module: use more typed_pos_args for consistencyEli Schwartz
It's shorter and more descriptive. Although we always enforce the same rules either way, a unified decorator is one less line of code for each location, and also tells you how many "too few" arguments you *did* pass.
2023-04-11fix various spelling issuesJosh Soref
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-02-13cmake: check that `re.search` returned a non-None valueDylan Baker
If an re call fails to find a match it returns None. We're not checking that, and crashing. Fixes: #11376
2023-02-01micro-optimize: define typing-only objects in TYPE_CHECKINGEli Schwartz
Union types that exist solely for use as annotations don't need to be created in normal runs.
2023-02-01treewide: add future annotations importEli Schwartz
2023-02-01pyupgrade: use set literalEli Schwartz
2022-11-30pylint: enable the set_membership pluginDylan Baker
Which adds the `use-set-for-membership` check. It's generally faster in python to use a set with the `in` keyword, because it's a hash check instead of a linear walk, this is especially true with strings, where it's actually O(n^2), one loop over the container, and an inner loop of the strings (as string comparison works by checking that `a[n] == b[n]`, in a loop). Also, I'm tired of complaining about this in reviews, let the tools do it for me :)
2022-11-29pylint: enable the bad_builtin checkerDylan Baker
This finds uses of deny-listed functions, which defaults to map and filter. These functions should be replaced by comprehensions in idiomatic python because: 1. comprehensions are more heavily optimized and are often faster 2. They avoid the need for lambdas in some cases, which make them faster 3. you can do the equivalent in one statement rather than two, which is faster 4. They're easier to read 5. if you need a concrete instance (ie, a list) then you don't have to convert the iterator to a list afterwards
2022-11-29Fix crash when toolchain is missingSmallWood-D
Add a MissingCompiler class returned by compiler detecting methods intead of None - accessing such an object raises a DependencyException Fixes #10586 Co-authored-by: duckflyer <duckflyer@gmail.com>
2022-11-24migrate some type comments to modern type annotationsEli Schwartz
flake8 6 upgrades to pyflakes 3, and in turn this means that support for parsing `# type: ` style annotations has been removed. https://github.com/PyCQA/pyflakes/pull/684 This caused one file to fail linting, because it had a typing import which was only used by a type comment. ``` mesonbuild/cmake/interpreter.py:55:5: F401 '.common.CMakeConfiguration' imported but unused ``` Updating it to actual annotations allows pyflakes to detect its usage again, and flake8 passes. Do the whole file while we are here.
2022-11-24remove a couple of unneeded type annotationsEli Schwartz
These are trivially inferred based on their initialized values.
2022-10-04pylint: enable use-a-generatorDylan Baker
This catches some optimization problems, mostly in the use of `all()` and `any()`. Basically writing `any([x == 5 for x in f])` vs `any(x == 5 for x in f)` reduces the performance because the entire concrete list must first be created, then iterated over, while in the second f is iterated and checked element by element.
2022-10-03pylint: enable unnecessary-comprehensionDylan Baker
2022-09-19pylint: enable consider-using-inDylan Baker
2022-09-19compilers: don't use instance checks to determine propertiesEli Schwartz
In various situations we want to figure out what type of compiler we have, because we want to know stuff like "is it the pgi one", or "does it use msvc style". The compiler object has this property already, via an API specifically designed to communicate this info, but instead we performed isinstance checks on a compiler class. This is confusing and indirect, and has the side effect of requiring more imports everywhere. We should do away with it.
2022-08-26Fix purely white space issues reported by flake8Alf Henrik Sauge
2022-07-18Applied tristan957's suggestionsVolker Weißmann
2022-07-18cmake module: Better warnings and error messages in some cases.Volker Weißmann
2022-07-03move various unused typing-only imports into type-checking blocksEli Schwartz
2022-07-03sort imports for neatnessEli Schwartz
2022-05-24cmake: fix detecting directories as input files (fixes #10244)Daniel Mensinger
2022-04-18Fix generator expression list problems (fixes #10288)Daniel Mensinger
2022-04-03cmake: Better error message when configuring a CMake subproject fails.Daniel Mensinger
2022-03-29Fix CMake deprecation warning generated from interpreterTristan Partin
2022-03-07Merge pull request #9743 from mensinda/cmakeGeneratorFixedJussi Pakkanen
cmake: Add TARGET_ generator expression support (fixes #9305)
2022-02-16flake8: fix wrong numbers of blank line separatorsEli Schwartz
2022-02-03cmake: Deprecate CMake <3.17 supportDaniel Mensinger
2022-02-03cmake: Drop CMake server support and bump min. CMake to >= 3.14Daniel Mensinger
2022-01-23cmake: Add TARGET_ generator expression support (fixes #9305)Daniel Mensinger
2022-01-23cmake: Move generator expression evaluation to the end of the traceparserDaniel Mensinger
2022-01-10port from embedded data to importlib.resourcesEli Schwartz
2021-12-02cmake: Deprecate CMake <3.14 and warn for <3.17 (#9677)Daniel Mensinger
* cmake: Deprecate CMake <3.14 and warn for <3.17 See: - #7832 - #9676 * cmake: Add deprecation release note snippet
2021-12-01cmake: Fix old style dependency lookup with imported targetsDaniel Mensinger
This also includes some refactoring, since the alternaticve would have been to duplicate the huge traceparser target code block again. fixes #9581
2021-11-21Support Visual Studio 2022 backendCrend King
2021-10-10Fix typos discovered by codespellChristian Clauss
2021-10-08cmake: handle arguments in the [binaries] section of the machine filePaolo Bonzini
Sometimes, the machine file can include compiler command line options, in order to pick the correct multilib. For example, Meson uses "$cc --print-search-dirs" to find the library search path, where $cc is the cc from the machine file. Because the outputs of "gcc -m32 --print-search-dirs" and "gcc --print-search-dirs" are different, this only works if you have [binaries] cc = ['gcc', '-m32'] in the machine file. Right now, however, the cmake module assumes that the compiler listed in the machine file is either a compiler, or a "launcher" followed by the compiler. Check if the second argument starts with a slash (for Microsoft-like compilers) or a dash (for everyone else), and if so presume that the CMAKE_*_COMPILER_LAUNCHER need not be defined.
2021-10-04remove double importEli Schwartz
Imported both inside and outside of T.TYPE_CHECKING, the runtime import can be removed by quote-deferring one of the use sites. Update: In between then and now, this got removed from T.TYPE_CHECKING, move it back there rather than preserving the runtime import.
2021-09-24pylint: check for duplicate importsDylan Baker
I ran into one of these from LGTM, and it would be nice if pylint could warn me as part of my local development process instead of waiting for the CI to tell me.
2021-09-14apply flake8 fixes for unused imports and missing importsEli Schwartz
2021-09-14semicolons are not needed in pythonEli Schwartz
2021-08-31pylint: turn on superflous-parensDylan Baker
We have a lot of these. Some of them are harmless, if unidiomatic, such as `if (condition)`, others are potentially dangerous `assert(...)`, as `assert(condtion)` works as expected, but `assert(condition, message)` will result in an assertion that never triggers, as what you're actually asserting is `bool(tuple[2])`, which will always be true.
2021-07-05more f-strings too complex to be caught by pyupgradeEli Schwartz
2021-07-05fix typo in log messageEli Schwartz
2021-07-05cmake: Only use the `cm_` prefix when it is actually required (fixes #8955)Daniel Mensinger