aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/interpreter.py
AgeCommit message (Collapse)AuthorFilesLines
2022-11-16Fix deprecation message, the function name is fs.copyfile()Xavier Claessens1-1/+1
2022-11-16Change the warning generated by importing an unstable module to non-fatalTristan Partin1-1/+1
Penalizing users for helping to test unstable modules really makes no sense. As a fatal warning, users can no longer use `--fatal-meson-warnings`.
2022-10-31both_libraries: Make sure to select the right linker for static libXavier Claessens1-3/+2
Regression test: libccpp has both C and C++ sources. The executable only has C sources. It should still link using the C++ compiler. When using both_libraries the static has no sources and thus no compilers, resulting in the executable linking using the C compiler. https://github.com/Netflix/vmaf/issues/1107
2022-10-31emit a FeatureNew when using include_directories as a stringEli Schwartz1-0/+7
This was introduced in commit 3a6e2aeed9737f1082571e868ba50e72957f27c7 as part of 0.50.0, but did not contain a FeatureNew. As a result, people would use it without realizing that they broke support for versions of Meson included in their minimum requirements.
2022-10-24Add missing since annotations in docsElliott Sales de Andrade1-1/+1
This is based on searching for `@FeatureNew*` decorators. There is also one correction to a version in a decorators; `build_by_default` was added in #1303, which is 0.38.0, not 0.40.0.
2022-10-24Accept disablers in summary valuesElliott Sales de Andrade1-1/+4
They are commonly used as a replacement for a `dependency`, and not accepting them in `summary` breaks the last example in [1] when used as a value. [1] https://mesonbuild.com/Disabler.html#disabling-parts-of-the-build
2022-10-24Add missing doc for NASM languageXavier Claessens1-0/+2
2022-10-23Fix excluding sources for static lib in both_libraries()Xavier Claessens1-10/+12
When using both_libraries(), or library() with default_library=both, we remove all sources from args and kwargs when building the static library, and replace them by the objects from the shared library. But sources could also come from any InternalDependency, in which case we currently build them twice (not efficient) and link both objects into the static library. It also means that when we needlessly build those source for the static library, it miss order dependency on generated headers that we removed from args/kwargs, which can cause build errors in the case the source from static lib is compiled before the header in shared lib gets generated. This happened in GLib: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2917.
2022-09-19pylint: enable use-sequence-for-iterationDylan Baker1-1/+1
This found a couple of places where we *don't* want to use set(), and want to use list() instead.
2022-09-06Fix install_subdirs not showing up in intro-install_plan.jsonThomas Li1-0/+5
2022-09-05interpreter: name typing-only kwargs import with an underscoreEli Schwartz1-41/+41
To differentiate it from the function parameter itself. Annotating a function as ``` def func_foo(kwargs: kwargs.FooKwargs): ``` is confusing, both visually and to static linters.
2022-09-05interpreter: add a few small func annotationsEli Schwartz1-4/+4
2022-08-29flake8: fix unnecessary f-strings without any format placeholdersEli Schwartz1-1/+1
These can just be ordinary strings.
2022-08-29flake8: fix lingering whitespace errorsEli Schwartz1-2/+0
2022-08-26Fix indentation issues reported by flake8, requiring code restructuringAlf Henrik Sauge1-9/+11
Strictly speaking code restructuring isn't needed, but making this PEP8 compliant results in indentation of the code that reduces the readability. By moving the offending code on the outside of the method call, the readability is maintained.
2022-08-26Fix purely white space issues reported by flake8Alf Henrik Sauge1-1/+1
2022-08-23install modes should not apply sticky bit to filesEli Schwartz1-6/+27
This is generally a bad idea, e.g. it causes OSError on freebsd. It also gets ignored by solaris and thus causes unittest failures. The proper solution is to simply reject any attempt to set this, and log a warning. The install_emptydir function does apply the mode as well, and since it is a directory it actually does something. This is the only place where we don't reset the mode. Although install_subdir also installs directories, and in theory it could set the mode as well, that would be a new feature. Also it doesn't provide much granularity and has mixed semantics with files. Better to let people use install_emptydir + install_subdir. Fixes #5902
2022-08-22introspection: untangle install_plan implemetation, fix a bunch of wrong onesEli Schwartz1-9/+8
Generally plumb through the values of get_option() passed to install_dir, and use this to establish the install plan name. Fixes several odd cases, such as: - {datadir} being prepended to "share" or "include" - dissociating custom install directories and writing them out as {prefix}/share/foo or {prefix}/lib/python3.10/site-packages This is the second half of #9478 Fixes #10601
2022-08-22interpreter: add a special class to track the lifecycle of get_option() stringsEli Schwartz1-0/+6
2022-08-18modules/pkgconfig: Use typed_kwargsDylan Baker1-25/+0
2022-08-18modules/fs: Replace configure_file(copy:) with fs.copyfileDylan Baker1-1/+4
`configure_file` is both an extremely complicated implementation, and a strange place for copying. It's a bit of a historical artifact, since the fs module didn't yet exist. It makes more sense to move this to the fs module and deprecate this `configure_file` version. This new version works at build time rather than configure time, which has the disadvantage it can't be passed to `run_command`, but with the advantage that changes to the input don't require a full reconfigure.
2022-08-17interpreter: deprecate the ability import unstable modules as `unstable_*`Dylan Baker1-0/+3
This was never meant to work, it's an implementation detail of using `importlib.import_module` and that our modules used to be named `unstable_` that this ever worked.
2022-08-17interpreter: move handling of module stability to interpreterDylan Baker1-31/+50
Thanks to `ModuleInfo`, all modules are just named `foo.py` instead of `unstable_foo.py`, which simplifies the import method a bit. This also allows for accurate FeatureNew/FeatureDeprecated use, as we know when the module was added and if/when it was stabilized.
2022-08-17modules: use module level information about new and deprecationDylan Baker1-6/+9
Instead of using FeatureNew/FeatureDeprecated in the module. The goal here is to be able to handle information about modules in a single place, instead of having to handle it separately. Each module simply defines some metadata, and then the interpreter handles the rest.
2022-08-15make add_project_dependencies respect build version of include dirsEli Schwartz1-1/+1
Fixes #10695
2022-08-10cmake: Add rule relaxations for CMake subprojectsDaniel Mensinger1-2/+27
fixes #10566
2022-07-17interpreter: Add return type to func_dependencyDylan Baker1-1/+1
2022-07-08implement the new preserve_path kwarg for install_data tooEli Schwartz1-7/+25
Primarily interesting to me because it is then available for the python module's install_sources method. Based on the new feature in install_headers.
2022-07-08fix incorrect type annotationEli Schwartz1-1/+1
In my attempts at actually using this, I discovered that no, it actually does take None.
2022-07-06Improve error message for `include_directories(abs_path_intree)`Ralf Gommers1-2/+7
This error message was quite confusing when triggered by use of an absolute path to the include dir of an external dependency (numpy in my case). Changing that to a relative dir also isn't a solution, because Meson will *not* do the "busywork to make paths work" that the error message says it will.
2022-06-17migrate declare_dependency to typed_kwargsEli Schwartz1-31/+33
2022-06-17refactor logic for parsing dependency variables into type_checking moduleEli Schwartz1-12/+10
We will momentarily use this to implement typed_kwargs, but not for all usage sites.
2022-06-17interpreter: fix a subproject check with symlinksHemmo Nieminen1-1/+1
The check for whether or not a file is allowed to be accessed from a subproject fails if the subproject is accessed via a symlink. Use the absolute path of the subproject without resolving symlinks to fix the check. Extend unit test 106 to check for this in the future.
2022-06-14Fix crash when a reconfigure adds a new subprojectXavier Claessens1-2/+1
When a subproject is disabled on the initial configuration we should not add it into self.coredata.initialized_subprojects because that will prevent calling self.coredata.init_builtins() on a reconfigure if the subproject gets enabled. Fixes: #10225.
2022-06-10add Feature checks for install_subdir creating an empty directoryEli Schwartz1-0/+7
Most importantly, tell people it's broken and to stop using it for 0.62.0
2022-06-01interpreter: add missing type annotationDylan Baker1-1/+1
2022-06-01interpreter: add location to a FeatureNew callDylan Baker1-2/+3
2022-06-01interpreter: use a shared KwargInfo for install_dirDylan Baker1-4/+5
CustomTarget allows multiple install dirs, while basically everything else allows only one. So this provides a shared instance for that.
2022-06-01Fix sandbox violation when using subproject as a symlinkVili Väinölä1-1/+1
Fix "Tried to grab file outside current (sub)project" error when subproject exists within a source tree but it is used through a symlink. Using subprojects as symlinks is very useful feature when migrating an existing codebase to meson that all sources do not need to be immediately moved to subprojects folder.
2022-05-31rename a badly named KwargInfoEli Schwartz1-3/+3
CT_OUTPUT_KW is the same OUTPUT_KW we use in lots of places. The most distinctive thing about it is not that it's part of custom_target (basically any other function that uses such a kwarg follows the same rules due to using CustomTarget under the hood), but the fact that it takes multiple outputs.
2022-05-31fix regression that broke type checking of CustomTarget outputsEli Schwartz1-3/+2
We validate a few things here, such as the non-presence of '@INPUT' in an output name. These got moved out of the CustomTarget constructor in commit 11f96380351a88059ec55f1070fdebc1b1033117 and into KwargInfo, but only for kwargs that took multiple values. This caused configure_file() and unstable_rust.bindgen() to stop checking for this. Add a shared single-output KW and use it in both places. This now dispatches to _output_validator. configure_file now validates subdirectories in output names the same way we do elsewhere, directly in the typed_kwargs and by specifying the erroring kwarg.
2022-05-31make sure no custom_target outputs are named "all" or "meson-internal__*"Eli Schwartz1-9/+15
Or any other reserved names. We check in add_target that the primary name of any build target isn't on the forbidden list, but custom_target allows names that are distinct from the output filenames, so we need to check those too. We would eventually still error out all the way at the end, with: ``` ERROR: Multiple producers for Ninja target "all". Please rename your targets. ``` But, if we can check that early and provide the underlying reason (reserved name) alongside actually useful debugging info (a line number), then why not? Refactor the check into a small helper function in the process.
2022-05-31relax target name restrictions to cater to internal useEli Schwartz1-2/+5
We don't want to allow targets that conflict with: - our aliased meson-* targets for phony commands - any meson-*/ directories we create for internal purposes We do want to allow targets such as: - our own meson-*.X manpages There are a couple routes we could take. Using a better restriction, such as `meson-internal__*`, is trivially done for our aliased targets, but changing directory names is... awkward. We probably cannot do this, and doing the former but not the latter is not very useful. We could also carefully allow patterns we know we won't use, such as file extensions, but which the manpages need, which works for our directories and for many aliased targets, but run_target() is user-specified and can be anything. Use a hybrid approach to cover both use cases. We will now allow target names that fulfill *all* the following criteria: - it begins with "meson-" - it doesn't continue with "internal__" - it has a file extension
2022-05-30Implement `preserve_path` for install_headersFlorian "sp1rit"​1-4/+18
The `install_headers` function now has an optional argument `preserve_path` that allows installing multi-directory headerfile structures that live alongside sourcecode with a single command. For example, the headerfile structure headers = [ 'one.h', 'two.h', 'alpha/one.h', 'alpha/two.h', 'alpha/three.h' 'beta/one.h' ] can now be passed to `install_headers(headers, subdir: 'mylib', preserve_path: true)` and the resulting directory tree will look like {prefix} └── include    └── mylib       ├── alpha       │   ├── one.h       │   ├── two.h       │   └── three.h       ├── beta       │   └── one.h       ├── one.h       └── two.h Fixes #3371
2022-05-30fix incorrectly allowed kwarg for custom_targetEli Schwartz1-3/+1
override_options makes no sense for custom_target as we don't use it for anything. Also, this was added in commit c3c30d4b060239654c9b848092692ab346ebed9d despite not being allowed in permittedKwargsc3c30d4b0. For inexplicable reasons, we had a known_kwargs for custom_target that looped over kwargs and issued a warning, not an error, for unknown kwargs. It was impossible to ever hit that check to begin with, though, ever since commit e08d73510552fa4a3a087af1a9e5fded8f5749fd which added permittedKwargs and obsoleted those manual checks with real errors. So at one point override_options was specially permitted to be used without emitting a warning, and then for about half a decade it was an error, and then based on some dead code it was allowed again for a bit. But through all this it doesn't do anything and isn't documented.
2022-05-25interpreter: add type restrictions to declare_dependency link_wholeDylan Baker1-2/+11
Including that we don't accept SharedLibraries or CustomTarget[Index]s that are a shared library
2022-05-25interpreter: add annotations to extract_variablesDylan Baker1-2/+4
2022-05-24ast: cmake: Generate line numbers while printing the AST for better debuggingDaniel Mensinger1-1/+1
2022-05-24fix traceback when run_command has a find_program as the inline argEli Schwartz1-1/+6
We were poking directly at the node, so if it was a FunctionNode then this broke. Instead, just do a reverse lookup in the overrides table to get the original find_program name.
2022-05-23interpreter: Add another overload to source_strings_to_filesDylan Baker1-0/+3
Which doesn't have `StructuredSources`, as is actually quite common.