| Age | Commit message (Collapse) | Author |
|
This is safer than parsing env from stdout
|
|
1. Generate OMF objs with `-Zomf' compiler flags
2. Generate OMF libs with `.lib' suffix using `emxomfar' as a librarian
|
|
|
|
cmd_line.txt is not related to serialized data, in fact it's a fallback
for when serialized data cannot be used and is also related to setting
up argparse for command line parsing. Since there is no code in common
with the rest of coredata, move it to a new module.
Fixes: #15081
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Defining public API in a cross platform library is painful, especially
on Windows. Since every library have to define pretty much the same
macros, better do it in Meson.
|
|
|
|
Changes from Dylan:
- Don't use Path
- merge the lint fixes
- Fix some typing issues
- Handle non-meson projects
- Remove some code duplication by putting `get_subproject_dir` in
utils
|
|
|
|
We don't want to have an `Optional` type here, we just want to tell mypy
that the value will be a FileLike object.
|
|
This allows us to simplify running mypy, as we can just mypy the entire
utils module regardless of the platform we're using. As an added bonus,
this means we open one less module.
|
|
backends.py has an interesting idiom for keeping the unique
elements of a list. This is much faster than OrderedSet:
* dict.fromkeys() vs. OrderedSet.__init__(): 35% faster on Python
3.13, 50-60% faster on Python 3.10
* list(d) (d is a dict) vs. list(os) (os is an OrderedSet): up to
25% faster on Python 3.13, up to 15% faster on Python 3.10
though it tapers out after a few hundred elements.
Add a function to mesonlib to encapsulate this idiom.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
.wraplock is nice to have, but prevents Meson from operating on a
read-only source directory.
If the source directory is read-only, there is no possible conflict
so in that case it is acceptable to return without any actual locking.
Fixes: #14948
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
`meson.py introspect build --targets` should show
`/path/to/project/hello.c` instead of
`/path/to/project/subdir/../hello.c` if
/path/to/project/meson.build contains subdir('subdir') and
/path/to/project/subdir/meson.build contains
executable('hello', '../hello.c').
|
|
cmake does preprocessing in a linear pass through the entire file
this allows recursive variable lookups which cannot be supported
by a basic regex implementation.
|
|
in cmake variables are pure strings with no minimal required length so
an empty string is a valid key and ${} needs to be handled accordingly.
|
|
just as with C defines cmakedefine supports a variable amount of
whitespace between the # symbol and the actual token.
|
|
When git is used with worktrees, `.git` will be a file containing a link
to the original repo. Currently, we say that this is not git because
`.git` isn't a directory.
|
|
DirectoryLock provides a generic locking implementation the replaces the
previously used BuildDirLock.
|
|
only the real arguments to response file
|
|
Since opt.deprecated is a dictionary with string keys, the lookup must use
str() around the user-provided value; with some care because booleans
will be the meson-ic 'true' and 'false' instead of Python's 'True' and
'False'.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Because we will need to call it from a module in a followup commit.
|
|
Introduce an alternative to os.path.commonpath(name, path) == path,
which is a common idiom throughout Meson. Call it is_parent_path
just like the existing static method in Generator.
It is a bit faster and handles drives on Windows without the need
for an exception handler.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
These are given a name that is different from __func.__name__, so
store the name when the descriptor is placed in the class.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Trying to chmod a symlink results in trying to chmod the file or
directory it points to, not the symlink itself which has no
permissions. Either a symlink points to within the tree we're making
writable in which case it'll be handled eventually by os.walk() or
it points outside of the tree we're making writable in which case
we don't want to touch it. Let's avoid touching files outside of the
tree by simply skipping symlinks in _make_tree_writable().
|
|
This allows us to simplify the initializers, as well as remove our
custom repr methods.
|
|
A Defaultable PerMachine has a type of `None | T`, in other words,
they have a base type of `PerMachine[None | T]`, but the purpose of
`PerMachine.default_missing()` is to get a `PerMachine[T]` from that
`PerMachine[None | T]`, therefore we should ensure that and annotate
that.
|
|
On Windows, if you accidently add a space at the end of a file name, like
`files('myfile.txt ')`, the file is not reported as missing, because of
the normalization performed by the OS. However, ninja will reference it
with the trailing space, and will fail because the file does not exist.
See https://github.com/python/cpython/issues/115104 for reference.
|
|
|
|
Version objects are created thousands of times by the check_version method of
decorators. Creation is inefficient, resulting in five calls to re.match()
that do not even use precompiled regex. The use of re.match() however is
fully redundant, as finditer() can provide the same information with a better
use of groupings. Do that and precompile the tokenization regex.
This saves about 3% in the "meson setup" run of QEMU.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
get_target_generated_sources often calls File.from_built_relative on
the same file, if it is used by many sources. This is a somewhat
expensive call both CPU- and memory-wise, so cache the creation
of build-directory files as well.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
|
|
the upstream behavior of configure_file in cmake parses both @VAR@ and ${VAR} and only supports disabling the bracket variables through the `@ONLY` argument, meson needs to follow this behavior for compatibility
|
|
It is useful to apply a limit to the number of processes even outside "meson test",
and specifically for clang tools. In preparation for this, generalize
determine_worker_count() to accept a variable MESON_NUM_PROCESSES instead of
MESON_TESTTHREADS, and use it throughout instead of multiprocessing.cpu_count().
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
There is no need to create and look up a dictionary when MachineChoice is
an enum, and there is no need to create a PerMachine object on every
__setitem__ of another PerMachine object.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
When projects do not specify a minimum meson version, we used to avoid
giving them the benefit of the Feature checks framework. Instead:
- warn for features that were added after the most recent semver bump,
since they aren't portable to the range of versions people might use
these days
- warn for features that were deprecated before the upcoming semver
bump, i.e. all deprecated features, since they aren't portable to
upcoming semver-compatible versions people might be imminently upgrading
to
|
|
This function is no longer used since shutil.which() is used instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The documentation for subprocess.run at https://docs.python.org/3/library/subprocess.html#popen-constructor has a warning,
pointing to using shutil.which() instead of subprocess.run for detecting if exe files exists on the path.
shutil.which() is used in many places already.
|
|
|
|
In commit 2cb7350d1679fb61826bf4aebfb0f75a9b9103e3 we added a special
case for environment() objects to allow skipping `meson --internal exe`
overhead when /usr/bin/env exists and can be used to set environment
variables instead of using a pickled wrapper.
This special case assumed that environment is used for setting
variables, but it is also possible, albeit less common, to
append/prepend to them, in which case `meson --internal exe` will
compute the final value as an offset from whatever the current environment
variables inherited from ninja are. It is not possible to precompute
this when generating command lines for ninja, so using arguments to
/usr/bin/env is not possible. All it can do is set (override) an
environment variable.
In this case, we have to use the python wrapper and cannot optimize it
away. Add a tracking bit to the env object and propagate it to the
backend.
|
|
When configuring a 'meson' or 'cmake@' style file,
add a case for escaped variables using matched pairs of
`\@` i.e. `\@foo\@ -> @foo@`.
The match for @var@ has been amended with a negative lookbehind
to ensure that any occurrances of `\@foo@` are not evaluated to
`\bar`.
The previous behaviour, matching `\@` and escaping only that character,
had undesirable side effects including mangling valid perl when
configuring files.
Closes: https://github.com/mesonbuild/meson/issues/7165
|
|
@PLAINNAME@ and @BASENAME@ cannot be used in custom_target()
with multiple inputs. For those, similar macros are needed
with an index.
Fixes #13164
|
|
Any code that needs to know mesonlib.python_command currently assumes
the PyInstaller bundle reference is added to the sys module, which means
that it assumes the only freeze tool used is PyInstaller. Really, all we
need to check is sys.frozen as it's never normally set, but always set
for a freeze. We don't care if it was PyInstaller specifically, and we
don't need its bundle directory.
See https://github.com/mesonbuild/meson/discussions/13007
|