Commit Graph

14 Commits

Author SHA1 Message Date
Dylan Baker e991c4d454 Use SPDX-License-Identifier consistently
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
2023-12-13 15:19:21 -05:00
Eli Schwartz 90ce084144
treewide: automatic rewriting of all comment-style type annotations
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-11 13:41:03 -04:00
Eli Schwartz a01418db0a
remove useless type annotations
These annotations all had a default initializer of the correct type, or
a parent class annotation.
2023-08-11 13:37:17 -04:00
kiwixz 4fab71f481 cmake: fix empty BOOL generator expression evaluating to true 2023-07-19 15:26:29 -07:00
Eli Schwartz 680b5ff819
treewide: add future annotations import 2023-02-01 17:01:30 -05:00
Dylan Baker 2d349eae8c
pylint: enable the set_membership plugin
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-30 16:23:29 -05:00
Dylan Baker a72840cd2e
pylint: enable use-a-generator
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-04 00:33:04 -04:00
Volker Weißmann 5f3c7125cc Applied tristan957's suggestions 2022-07-18 13:46:26 +02:00
Volker Weißmann cdd2dca174 cmake module: Better warnings and error messages in some cases. 2022-07-18 13:46:26 +02:00
Daniel Mensinger 42843c4cf6
cmake: Add TARGET_ generator expression support (fixes #9305) 2022-01-23 13:22:59 +01:00
Daniel Mensinger 99aae9b4df
cmake: Move generator expression evaluation to the end of the traceparser 2022-01-23 13:22:47 +01:00
Daniel Mensinger 0e777e7c90
cmake: CMakeTraceParser improvements
- handle cached CMake variables differently
 - associate variables with source files
 - better performance (str to Path and generator expressions)
2021-05-29 13:20:25 +02:00
Daniel Mensinger fc80518a07
typing: fully annotate cmake.generator 2020-09-28 13:51:19 +02:00
Daniel Mensinger bee74eea16
cmake: Parse a subset of generator expressions 2019-07-31 17:50:02 +02:00