aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
AgeCommit message (Collapse)AuthorFilesLines
2023-03-16modules/i18n: fix typo in gettext decoratorCorentin Noël1-1/+1
2023-03-16hotdoc: Install devhelp files at the right locationXavier Claessens1-1/+14
When devhelp is enabled, hotdoc generates a devhelp/ subdir that needs to be installed to /usr/share/devhelp/. Otherwise, the html/ subdir needs to be installed to /usr/share/doc/<project>/html/
2023-03-05hotdoc module: properly error out when configuring failsEli Schwartz1-1/+2
We used to just abort during configure because we ran in-process and hotdoc's argparse would leak into our own process space. Now we fail to handle this case and succeed at configuring, only for building to fail because the hotdoc config file doesn't exist.
2023-03-04typed_kwargs: Extend since_values and deprecated_values for typesXavier Claessens1-2/+2
2023-02-22merge the python dependency from the python module into dependenciesEli Schwartz1-206/+2
We have two copies of this code, and the python module one is vastly superior, not just because it allows choosing which python executable to base itself on. Unify this. Fixes various issues including non-Windows support for sysconfig, and pypy edge cases.
2023-02-22partial migration of the python module dependency into dependenciesEli Schwartz1-59/+2
In preparation for wholly merging the dependency handling from the python module into dependencies.*, move the unique class definitions from there into their new home in dependencies.python, which is semantically convenient.
2023-02-22python module/dependency: move the specialized external programEli Schwartz1-77/+11
In preparation for handling more work inside dependencies.*, we need to be able to run a PythonExternalProgram from the python dependency. Move most of the definition -- but only the parts that have no interest in a ModuleState -- and subclass a bit of sanity checking that we need to handle specially when used in the module.
2023-02-22python module: inline the dependency methods checkingEli Schwartz1-3/+3
It can go directly inside the function which immediately uses it. There's no purpose in looking it up exactly once and using it exactly once, but looking it up outside the function and complicating the function signature in order to pass it as a function argument.
2023-02-22python module: move the introspection script into an external scriptEli Schwartz1-79/+6
We write this out as an embedded string to a tempfile in order to run it, which is pretty awkward. And usually Meson's files are already files on disk, not packed into a zip, so we can simply run it directly. Since python 3.7, which is our new minimum, we can handle this well via the stdlib. (There's also mesonbuild.mesondata, but we do not need persistence in the builddir.) This also solves the problem that has always been there, of giant python programs inside strings occasionally confusing syntax highlighters. Or even, it would be nice if we had syntax highlighting for this introspection program. :D
2023-02-22python module: break the association between dependency and installation objectsEli Schwartz1-18/+19
We pass around a PythonInstallation into the depths of the dependency factory, solely so that we can get at is_pypy in one particular branch. We don't need the DSL functions, we don't need access to the interpreter, let's just use the enhanced ExternalProgram object on its own. Add is_pypy to the object, and modify other references to get information from .info['...'] instead of direct access.
2023-02-22python module: fix a few mypy issuesEli Schwartz1-4/+8
Of particular note: We technically cannot pass a NotFoundDependency out of a factory lookup, because it doesn't support External interfaces.
2023-02-08Replace dashes in Java package names with underscores when generating native ↵Tristan Partin1-3/+6
headers This was causing a ninja issue where the native headers were always being generated because io.github.hse-project.hse_Hse.h was being expected, but io.github.hse_project.hse_Hse.h was actually generated.
2023-02-02set default install_tag of python.install_sources() to "python-runtime"Peter Urban1-1/+1
the default parameter for python.install_sources is set to "runtime" but should be "python-runtime" according to the existing documentation - https://mesonbuild.com/Python-module.html#install_sources - https://mesonbuild.com/Installing.html#installation-tags
2023-02-01simplify instantiation of builtin type using builtins instead of functionsEli Schwartz1-2/+2
2023-02-01treewide: add future annotations importEli Schwartz8-2/+8
2023-01-26gnome: Deduplicate include dirs to generate girThibault Saunier1-3/+3
Ensuring the order is respected
2023-01-20Haiku pkgconfig directory layout supportX5121-0/+3
2023-01-10modules: fully type the Qt* modulesDylan Baker3-9/+26
The base module is fully typed, but the numbered version are not, though it's pretty trivial to do so.
2023-01-10modules: add type annotations to the `__init__` moduleDylan Baker1-8/+9
2023-01-10modules/external_project: `make` should be immutableDylan Baker1-1/+6
In some cases we'll get an `ImmutableListProtocol[str]` anyway (and actually, we should probably be getting one in call cases), since we don't mutate it anyway, just store it as immutable.
2023-01-10modules/i18n: fix type annotationsDylan Baker1-1/+1
Again, state.find_program is wrong
2023-01-10modules/icestorm: fix type annotationsDylan Baker1-1/+1
This is also due to the incorrect annotations of state.find_program()
2023-01-10modules/qt: Fix annotations for state.find_programDylan Baker1-3/+3
Because this too, has the wrong assumptions
2023-01-10modules/rust: Fix annotation for _bindgen_binDylan Baker1-2/+2
Which suffers from the same issue as the gnome module
2023-01-10modules/gnome: fix type annotations from `__init__`, which are wrongDylan Baker1-9/+10
Mainly thi sis that `state.find_program()` is annotated incorrectly, it returns `ExternalProgram | Executable | OverrideProgram`, but it's annotated to return only `ExteranlProgram`, and thus a bunch of the annotations in the gnome module are wrong.
2023-01-04forbid using declare_dependency(objects: ...) with pkg-config modulePaolo Bonzini1-0/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-01-04add objects keyword argument to declare_dependenciesPaolo Bonzini2-2/+2
2023-01-03modules/gnome: use `mlog.log(once=True)` in a few more placesDylan Baker1-2/+2
It's probably not useful to spam the user with warnings that old versions of software may not behave correctly when the first warning was perfectly valid.
2023-01-03Add fatal=False to many mlog.warnings()Dylan Baker1-3/+5
There are lots of warnings that become fatal, that are simply unfixable by the end user. Things like using old versions of software (because they're using some kind of LTS release), warnings about compilers not supporting certain kinds of checks, or standards being upgraded due to skipped implementations (MSVC has c++98 and c++14, but not c++11). None of these should be fatal, they're informative, and too important to reduce to notices, but not important enough to stop meson if they're printed.
2022-12-12Fixing typosAndreas Deininger1-1/+1
Convert http to https in some links
2022-12-11fix broken fs.copyfile function that crashed if you tried to use itEli Schwartz2-5/+3
At least, if you tried to use it when passing an install_dir. Because T.Sequence is horrible and we should never use it, and the annotations are a lie that produces bugs. So, fix the annotations on CustomTarget to never allow this to happen again, and also fix the function too. Move some definitions elsewhere inline to satisfy the linter. Fixes #11157
2022-12-11typing: fix some broken Sequence annotationsEli Schwartz1-1/+1
T.Sequence is a questionable concept. The idea is to hammer out generic, maximally forgiving APIs that operate on protocols, which is a fancy way of saying "I don't care if you use tuples or lists". This is rarely needed, actually, and in exchange for this fancy behavior you get free bugs. Specifically, `somestr` is of type `T.Sequence[str]`, and also `somestr[0]` is another string of type you guessed it. It's ~~turtles~~ strings all the way down. It's worth noting that trying to code for "protocols" is a broken concept if the contents have semantic meaning, e.g. it operates on "the install tags of this object" rather than "an iterable that supports efficient element access". The other way to use T.Sequence is "I don't like that T.List is invariant, but also I don't like that T.Tuple makes you specify exact ordering". This sort of works. In fact it probably does work as long as you don't allow str in your sequences, which of course everyone allows anyway. Use of Sequence has cute side effects, such as actually passing lists around, knowing that you are going to get a list and knowing that you need to pass it on as a list, and then having to re-allocate as `list(mylist)` "because the type annotations says it could be a str or tuple". Except it cannot be a str, because if it is then the application is fatally flawed and logic errors occur to disastrous end user effects, and the type annotations: - do not enforce their promises of annotating types - fail to live up to "minimal runtime penalties" due to all the `list()` Shun this broken concept, by hardening the type annotations. As it turns out, we do not actually need any of this covariance or protocol-ism for a list of strings! The whole attempt was a slow, buggy waste of time.
2022-12-11simplify install_tag handling according to the accepted APIEli Schwartz1-1/+1
There are two problems here: a typing problem, and an algorithm problem. We expect it to always be passed to CustomTarget() as a list, but we ran list() on it, which became horribly mangled if you violated the types and passed a string instead. This caused weird*er* errors and didn't even do anything. We want to do all validation in the interpreter, anyway, and make the build level dumb. Meanwhile we type it as accepting a T.Sequence, which technically permits... a string, actually. This isn't intentional; the point of using T.Sequence is out of a misguided idea that APIs are supposed to be "technically correct" by allowing "anything that fulfills an interface", which is a flawed concept because we aren't using interfaces here, and also because "technically string fulfills the same interface as a list, if we're talking sequences". Basically: - mypy is broken by design, because it typechecks "python", not "what we wish python to be" - we do not actually need to graciously permit passing tuples instead of lists As far as historic implementations of this logic go, we have formerly: - originally, typeslistified anything - switched to accepting list from the interpreter, redundantly ran list() on the list we got, and mishandling API violations passing a string (commit 11f96380351a88059ec55f1070fdebc1b1033117) - switched to accepting anything, stringlistifying it if it was not `None`, mishandling `[None]`, and invoking list(x) on a brand new list from stringlistify (commit 157d43883515507f42618b065a64fb26501734a0) - stopped stringlistify, just accept T.List[str | None] and re-cast to list, violates typing because we use/handle plain None too (commit a8521fef70ef76fb742d80aceb2e9ed634bd6a70) - break typing by declaring we accept a simple string, which still results in mishandling by converting 'foo' -> ['f', 'o', 'o'] (commit ac576530c43734495815f22456596772a8f6a8cc) All of this. ALL of it. Is because we tried to be fancy and say we accept T.Tuple; the only version of this logic that has ever worked correctly is the original untyped do-all-validation-in-the-build-phase typeslistified version. Let's just call it what it is. We want a list | None, and we handle it too.
2022-12-11Fix package kwarg typeTristan Partin1-2/+3
2022-12-11Rename java.generate_native_headers to java.native_headersTristan Partin1-0/+18
This follows the Meson naming scheme which typically leaves off a verb like generate.
2022-12-11Remove java.generate_native_headerTristan Partin1-45/+0
This API existed for 2 minor releases and was worthless for pretty much every usecase.
2022-12-11CUDA: Update compute-capability limits logic for CUDA 12.Olexa Bilaniuk1-0/+8
In particular, CUDA 12 removes support for Kepler (3.x) entirely. Unusually, however, it does not introduce any new architectures, or even compute capabilities.
2022-12-11CUDA: Add listing for newly-released CUDA 12 in minimum driver version table.Olexa Bilaniuk1-0/+1
2022-12-11Merge pull request #11024 from dcbaker/submit/bindgen-dependenciesJussi Pakkanen1-15/+25
Add a `dependencies` keyword argument to bindgen
2022-12-09Merge pull request #10990 from xclaesse/devenvJussi Pakkanen1-3/+2
devenv: various improvements
2022-12-09python module: don't overwrite and destroy the .pc dependency nameEli Schwartz1-1/+0
When finding a py.dependency() we try to use pkg-config. We then apply our own custom base class, which replaces self.name with the informative comment "override the name from the "real" dependency lookup", to which I can only say "uhhh why". Why do we want to do that??? It turns out we don't, it was just a really old legacy design because we had a SystemDependency with a .pkgdep attribute hiding the real dependency bizarro-land style. We cleaned that up in commit 4d67dd19e5b7dcec6716840d30984fa41eef55c6 and as part of that, we *shifted over* the self.name assignment to preserve the visible effects, sort of. We didn't have a *reason* to override the name, we just did it because... we weren't sure whether it mattered. Unfortunately it very much does matter the other way -- we don't want it. We can pass this dependency to the pkgconfig module, which uses the name attribute to fill out the `Requires: ` field. Also, the name should name what we have. :p Get rid of this bizarre historic quirk. Since we have proper dependencies here, we should go all in. Fixes https://github.com/ufo-kit/ufo-core/pull/185#issuecomment-1328224996
2022-12-07Remove useless EmptyExternalProgramXavier Claessens1-3/+2
It is only used by Environment.get_exe_wrapper() and every callers were handling None already. Type annotation was wrong, it already could return None for the case an exe wrapper is needed but none is provided.
2022-12-05modules/rust: Add support for dependencies in bindgenDylan Baker1-3/+16
This is needed for cases where we need external C headers, which are passed to clang.
2022-12-05modules/rust: Use `__future__.annotations`Dylan Baker1-6/+7
2022-12-05modules/rust: use the shared DEPENDENCIES_KWDylan Baker1-6/+2
2022-12-05modules/rust: Add support for string include_directoriesDylan Baker1-3/+3
Which we support for basically every other case, but not this one.
2022-12-05modules: Add a method to the state object for include_dirsDylan Baker1-1/+15
The Interpreter has a method for this, and the module state just wraps it.
2022-12-05interpreter: move TEST_KW from interpreter.py to type_checking.pyDylan Baker1-2/+2
Since it's also used in the rust module, it should be in a common place. Also rename from `TEST_KWARGS` to `TEST_KWS`, which is more in line with the `*_KW` naming scheme used in the type_checking module.
2022-11-30pylint: enable the set_membership pluginDylan Baker3-4/+4
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 Baker1-1/+1
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