Commit Graph

39 Commits

Author SHA1 Message Date
Eli Schwartz 5e76e2a7ff
Add missing FeatureNew for meson.add_dist_script
Per the docs, it is available since 0.48.0. Notify about this at runtime
too.

Fixes #12773
2024-01-25 00:33:40 -05:00
Eli Schwartz 7afc69254d
fix implicit_reexport issues and enforce them going forward
This detects cases where module A imports a function from B, and C
imports that same function from A instead of B. It's not part of the API
contract of A, and causes innocent refactoring to break things.
2023-07-19 18:31:37 -04:00
Jussi Pakkanen 23efc1abea Alphabetize methods in MesonMain. 2023-06-19 18:03:57 +03:00
Josh Soref cf9fd56bc9 fix various spelling issues
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-11 19:21:05 -04:00
L. E. Segovia 088727164d interpreter/mesonmain: Add build_options method
This method allows meson.build to introspect on the changed options.
It works by merely exposing the same set of data that is logged by
MesonApp._generate.

Fixes #10898
2023-02-20 11:05:06 -05:00
Charles Brunet 04f233a80d allow install script to run in dry-run mode 2023-02-14 10:50:10 -05:00
Charles Brunet ce62190b17 Fix displaying outputs with add_*_script
#8259 induced a regression, causing Meson 0.57.0 and upward to
stop printing outputs of scripts added using `meson.add_*_script()`.
This makes _find_source_scripts() mark executables as verbose
in meson_exe.
2023-02-13 13:13:04 -05:00
Eli Schwartz 2fa0749175
add license_files kwarg to project
Hook this up to installed dependency manifests. This is often needed
above and beyond just an SPDX string -- e.g. many licenses have custom
copyright lines.
2022-12-27 20:29:46 -05:00
Eli Schwartz a009eacc65
treewide: string-quote the first argument to T.cast
Using future annotations, type annotations become strings at runtime and
don't impact performance. This is not possible to do with T.cast though,
because it is a function argument instead of an annotation.

Quote the type argument everywhere in order to have the same effect as
future annotations. This also allows linters to better detect in some
cases that a given import is typing-only.
2022-03-07 19:01:04 -05:00
Xavier Claessens 6acfe48f32 Allow setting method/separator in environment() and meson.add_devenv() 2022-02-28 09:03:27 -05:00
Eli Schwartz d082204096
mdist: fix dist scripts in subprojects being marked as superproject scripts
This has never worked for built/found programs, only for script files.

In commit 2fabd4c7dc scripts learned an
attribute stating which subproject they came from. In commit
3990754bf5 dist scripts learned to run
even from a subproject, and relied on that attribute to know when, in
fact, they came from a subproject.

Unfortunately the original attribute was only set in one half of an
if/else, and the other half returned early with only part of the work
done.

Fixes #9964
2022-02-07 16:12:37 -05:00
Eli Schwartz d9f55d774c
add location data to various Feature checks 2022-01-27 22:11:48 -05:00
Eli Schwartz cb6a6dbca4
remove no longer needed validation routine
We don't need to check when processing the script args, whether the
correct types were passed. We check this upfront in typed_pos_args now.
2021-12-30 15:14:18 -05:00
Eli Schwartz 6e25548d06
add_*_script: fix incorrect typed_pos_args allowing built targets
In commit c239ce31f5 support was added to
these functions to accept various non-string types.

Despite the commit/PR documenting that only add_install_script is
permitted to accept built files, the actual check parameter was set, for
all three, to "True" (so the function was never invoked with False at
all). This meant that actually attempting to use the allowed types would
fail at postconf or dist, with python tracebacks in the former case and
"Failed to run dist script" in the latter case.

This was partially ameliorated in commit
6c5bfd4c24 which added typed_pos_args, but
unfortunately those typed_pos_args were all over the place.

For postconf:
- They banned external programs as additional args (which should be allowed)
- They banned built executables (good)
- They allowed custom targets as additional args (bad)

For dist:
- they allowed external programs (good)
- they allowed built executables, but only as the first argument (bad, also ???)
- they allowed custom targets, but only as additional arguments (bad, also ???)

Fix this all to only allow the same argument types for both the script
argument and the script-args arguments. That type is known at configure
time and restricted to source files, configured files, and found
programs.
2021-12-30 15:14:18 -05:00
Eli Schwartz f6eaf55906
add_*_script: fix missing FeatureNew for non-string arguments
In commit 2c0eaf5c4f support was added for
install scripts to accept found programs, built executables, or custom targets.

In commit c239ce31f5, this was extended to
dist and postconf scripts too (although it was documented that those
should not accept targets that are built by ninja).

Despite the commit/PR claiming that all of these should always accept
files and configured files, this was only true for arguments other than
the first, until commit f808c955ea.

In amongst all this, FeatureNew checks were never registered for the
first argument, only for additional arguments, until late in the game
with the addition of FeatureNew checks for File objects.

Fix this in part by moving the 3 different File checks into one, inside the
function that processes the first script, and make that function check
for FeatureNew on anything else too.
2021-12-30 15:14:17 -05:00
Dylan Baker 822b087f24 interpreter: use find_program_impl internally instead of func_find_program
Calling interpreter implementation methods is just a bad idea, apart
from the extra type checking that goes into it, we need to pass more
arguments than we need to calling the impl method.
2021-11-22 11:28:43 -08:00
Paolo Bonzini 9a8c2d23f1 interpreter: disallow RunTarget in meson.add_install_script
Without this patch, the name of the RunTarget is passed to the
install script; for the enclosed test, meson setup (incorrectly)
succeeds, but installation fails.
2021-11-15 11:33:00 +01:00
rusty-snake 44b4fc914e Typo fixes (CustomTaget -> CustomTarget) 2021-10-30 14:29:17 -04:00
Xavier Claessens 3902bd4ef1 Fix add_install_script() ignoring install_tag
Fixes: #9454
2021-10-27 20:49:28 -04:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Eli Schwartz 4ab70c5512
fix extra whitespace
discovered via flake8 --select E303
2021-10-04 16:29:31 -04:00
Daniel Mensinger d93d01b6c5 interpreter: Introduce StringHolder
Another commit in my quest to rid InterpreterBase from all higher
level object processing logic.

Additionally, there is a a logic change here, since `str.join` now
uses varargs and can now accept more than one argument (and supports
list flattening).
2021-09-25 12:44:11 +02:00
Dylan Baker 5a69dbe0cb interpreter/mesonmain: remove unreachable code
Now that we have type checking, we can be sure that this code is
unreachable, and remove it.
2021-09-24 10:36:05 -07:00
Dylan Baker 92b21a0045 interpreter/mesonmain: Fix remaining typing problems and add to run_mypy 2021-09-24 10:36:05 -07:00
Dylan Baker d661a0cd96 build: use an object rather than a dict for the dep_manifest
This really is more of a struct than a dict, as the types are disjoint
and they are internally handled, (ie, not from user input). This cleans
some things up, in addition I spotted a bug in the ModuleState where the
dict with the version and license is passed to a field that expects just
the version string.
2021-09-24 10:36:05 -07:00
Dylan Baker 6c5bfd4c24 interpreter/mesonmain: Add full set of typed_argument guards 2021-09-24 09:48:47 -07:00
Dylan Baker 27fd7b14e7 interpreter/mesonmain: fix type annotations
Taht should have been converted to build/program module objects, not
interpterter objects
2021-09-24 09:47:38 -07:00
Dylan Baker 3731e1d8f3 make EnvironmentVariablesObject a proper holder
Currently, EnvironmentVariablesObject is a strange
holder-that's-not-a-holder. This has implicaitons for things that expect
to get an EnvironmentVariables object, as we can't automatically
unholder it, and instead have to to manually do so. Now we can
automatically unholder it, which makes everything much nicer.
2021-08-30 18:05:02 -07:00
Xavier Claessens ab773ff9e8 Simplify condition in can_run_host_binaries() 2021-08-30 14:00:54 -04:00
Dylan Baker 11fbaf29d8 interpreter: fix cases of `KwargInfo(..., T, default=None)`
The correct way to mark these is `KwargInfo(..., (T, type(None)))`.
There's also a few cases of `(T, None)` which is invalid, as `None`
isn't a type
2021-08-27 14:54:29 -07:00
Xavier Claessens e646130ef1 interpreter: Fix dependency(..., static: true) fallback
It should build the fallback subprject with default_library=static and
override the dependency for both static=True and static kwarg not given.

Fixes: #8050.
2021-08-23 10:52:18 -04:00
Xavier Claessens 8c5aa031b5 Add install tags
Fixes: #7007.
2021-08-17 15:19:18 -04:00
Xavier Claessens 0183954ea1 Fix meson.version().version_compare() regression in subproject 2021-07-21 13:33:06 -04:00
Eli Schwartz dd31891c1f more f-strings too complex to be caught by pyupgrade 2021-07-05 17:55:04 +03:00
Daniel Mensinger 7c757dff71 holders: Fix the remaining code to respect the holder changes 2021-06-18 23:48:33 +02:00
Daniel Mensinger 34c28dc92c holders: remove unholder 2021-06-18 23:48:33 +02:00
Daniel Mensinger 63ade7d937 interpreter: Add a new MesonInterpreterObject for non-elementary objects 2021-06-18 23:48:33 +02:00
Xavier Claessens 5440ce003b Add global_source/build_root() 2021-04-09 09:29:12 -07:00
Xavier Claessens 558a7bc6ff interpreter: Move to its own folder and split it 2021-04-01 14:26:33 -04:00