| Age | Commit message (Collapse) | Author |
|
Popen_safe_logged has a small inefficiency. It evaluates the stripped
version of stdout/stderr before checking if it exists, for logging
purposes. This would sometimes crash, if it was None instead of ''.
Fixes #12979
|
|
|
|
This function is used at 3 different places and it does not justify it
as being a staticmethod instead of being a free function.
|
|
|
|
The standard library accepts None defaults for some kwargs and we should
too.
|
|
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
|
|
This caused a regression with mesondefine where
`conf_data.set("FOO", true)`
turned into
`#define FOO 1`
instead of
`#define FOO`
|
|
Old:
```
OrderedSet("'foo'", "'bar'", "'baz'")
```
New:
```
OrderedSet(['foo', 'bar', 'baz'])
```
The old one looked nasty *and* was totally non-functional.
|
|
|
|
Allow macro_name to be speficied as a parameter to configure_file().
This allows C macro-style include guards to be added to
configure_file()'s output when a template file is not given. This change
simplifies the creation of configure files that define macros with
dynamic names and want the C-style include guards.
|
|
Coredata is where all option handling is done so it makes sense there.
It is a view on a list of options for a given subproject and with
optional overrides. This change prepare for using that view in a more
generic way in the future.
|
|
|
|
|
|
This is our standard annotation policy, and makes mypy safe under python
3.7
|
|
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/
```
|
|
Popen can raise OSError when program is not found, or PermissionError if
not executable, etc.
|
|
- allow defines with leading whitespace
- always do replacement for cmakedefine
- output boolean value for cmakedefine01
- correct unittests for cmakedefine
- add cmakedefine specific unittests
|
|
meson tests enable PYTHONWARNDEFAULTENCODING by default and
make EncodingWarning fatal too.
Starting with Python 3.11 CPython not only warns if no encoding is passed
to open() but also to things like subprocess.check_output(). This made
the call in vsenv.py fail and in turn made test_vsenv_option fail.
check_output() here calls a .bat file which in turn calls vcvars. I don't
know what the encoding is supposed to be used there, so just be explicit
with the locale encoding to silence the warning.
|
|
|
|
capture is the optional filename stdout is redirected to.
feed is the optional filename stdin reads from.
|
|
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.
|
|
Some various type related cleanups
|
|
Some macos libraries use arm64e instead of arm64 as architecture. Due to the
string replace approach taken so far, we'd end up with aarch64e as
architecture, which the rest of meson doesn't know.
Move architecture mapping to map whole architecture names and add arm64e ->
aarch64 mapping.
This change doesn't touch the case for armv7[s], where we add arm, rather than
replace armv7[s], but it's certainly not in line with the other mappings.
Fixes: #9493
Co-authored-by: Tristan Partin <tristan@partin.io>
|
|
It wasn't being used.
|
|
This pleases pyright/pylance and is a pattern that we use in other
portions of the code.
|
|
Added type arguments where needed.
|
|
Names and types of some methods did not match their parent methods.
|
|
Although mypy wasn't complaining, pyright was.
|
|
|
|
Post-facto application of issues that were caught during post-merge
review, after the genvslite PR was merged without a full review.
|
|
|
|
This fallbacks to short commit id in case the git repository does
not contain any annotated tag, for example before the first release of a
project.
|
|
- Do not hardcode terminal width of 100 chars, that breaks rendering on
smaller terminal. It already uses current console width by default.
- Disable progress bar when downloading from msubprojects because it
fetches multiple wraps in parallel.
- Scale unit when downloading e.g. MB/s.
- Do not display rate when it's not a download.
- Do not display time elapsed to simplify the rendering.
|
|
This is useful for internal scripts that want to know about something
other than MESON_INSTALL_PREFIX and MESON_INSTALL_DESTDIR_PREFIX, which
is very specific to the prefix.
|
|
Fixes #384
|
|
Checking the executable basename sort of works, at least for Windows,
since Windows always happens to use exactly this approach. However, the
official pyinstaller documentation suggests a very different approach:
https://pyinstaller.org/en/stable/runtime-information.html
This approach is more robust since it works on any OS, and in particular
it allows me to test the PyInstaller bundle functionality on Linux, even
though we don't officially distribute it as such.
|
|
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
|
|
We need to remember its value when reconfiguring, but the Build object
is not reused, only coredata is.
This also makes CLI more consistent by allowing `-Dvsenv=true` syntax.
Fixes: #11309
|
|
In commit 97a72a1c53e68cf53541285075b4000f7c85ccc6 we started to allow
cmakedefine with 3 tokens, as cmake expects (unlike mesondefine). This
would silently start working even if the declared minimum version was
older than 0.54.1
|
|
It's actually Generic, and we should use Generic annotations to get the
correct result. This means that we don't have to assert or cast the
return type, because mypy just knowns
|
|
This can raise any OSError, but we only caught two of them that indicate
a particular failure case. Also catch the generic error form with a more
generic message.
This produces better error messages in cases where e.g. exclusive lock
is not supported.
|
|
|
|
|
|
Union types that exist solely for use as annotations don't need to be
created in normal runs.
|
|
|
|
|
|
We shouldn't be hardcoding library dirs anyway. And we usually get this
from the compiler.
This function has been unused since its users were moved to use the
compiler method, in the following commits:
- a1a4f66e6d915c1f6aae2ead02cf5631b10c76f1
- a3856be1d50eaefe32fee5d3347d55d934d15b50
- 08224dafcba1b694fb624553e7d84deb565aae22
|
|
It is often more useful to generate shell script than dumping to stdout.
It is also important to be able to select the shell format.
Formats currently implemented:
- sh: Basic VAR=prepend_value:$VAR
- export: Same as 'sh', but also export VAR
- vscode: Same as 'sh', but without substitutions because they don't
seems to work. To be used in launch.json's envFile.
|
|
EnvironmentVariables was always broken, it used MutableMapping because
everyone <3 abstract interfaces, especially when they are broken and
don't actually do what you want.
This needs a dict interface, exposing `.copy()`. We either use a dict or
os._Environ, and the latter also supports that.
Also fix a broken import, and the fallout from forgetting to update the
signature of self.envvars in commit b926374205bd761085031755c87152d08bc10e9d.
|
|
After tracing all the way down to the bottom of this (or really, adding
annotations so mypy can) it turns out that passing file would just be
ignored at the end of the mlog call stack, so it should be removed
|