Age | Commit message (Collapse) | Author | Files | Lines |
|
Instead of being instance state, it's passed around. This isn't a big
deal internally since most of the users are protected, and the only time
an external change is required is a couple of places in msubprojects,
which is fine because the information is available.
Fixes: #12869
|
|
It's overwritten before it's ever read
|
|
It returns `None | PackageDefinition`, not `PackageDefinition`
|
|
These aren't meant to be called externally. Additionally, they expect
some statefulness from the `resolve()` method, and by making them
protected we can more easily remove this statefulness.
|
|
|
|
Fixes https://github.com/mesonbuild/meson/issues/12092
|
|
This reverts commit 718c86a7d577e6474ff325957248724d9b786174.
We can't always use git to apply patches because they might actually
apply to a git submodule inside a git subproject, and git will not be
able to apply the patch in that case.
|
|
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
|
|
"meson wrap status" was calling it for each .wrap file. Better use
lru_cache to ensure we don't make the same mistake elsewhere.
|
|
Update command is implemented in msubprojects.py, because it can update
all wraps in parallel.
|
|
line argument code
|
|
|
|
This most likely happens when the source archive has files which take
advantage of case sensitivity, and someone is unfortunate enough to have
to work with broken operating systems that do not have the capacity to
use modern technology, like the 1970s invention of case sensitive
filesystems.
For example, Windows and macOS both have retrocomputing environments,
where case sensitive abilities were carefully removed from modern
filesystems in order to share the delights of classical computing with
the masses.
On such systems, innocent tarballs fail to extract with:
```
OSError: [Errno 22] Invalid argument: 'C:\path\to\file'
```
thereby demonstrating Microsoft's unbounded and enthusiastic love for
users (who are, universally, retrocomputing fans).
n.b. there is, begrudgingly, a secret option for crazy people who hate
retrocomputing to enable modern 1970s computing on Windows systems.
Naturally, no one with any sense would ever use this, and it is rightly
left in its sensible default in for example Github Actions.
Fixes #12344
|
|
The method can be overridden by setting the `method` key in the wrap
file and always defaults to 'meson'. cmake.subproject() is still needed
in case specific cmake options need to be passed.
This also makes it easier to extend to other methods in the future e.g.
cargo.
|
|
This solves problems with Strawberry Perl providing patch.exe on Windows
with an unconsistent line ending support.
Fixes: #12092
|
|
Allow packagecache to contain already extracted directory to match what
some distro does with Cargo source packages in /usr/share/cargo/registry.
Note that there is no need to lock the cache directory because we
download into a temporary name and atomically rename afterward. It means
we could be downloading the same file twice, but at least integrity is
guaranteed.
Fixes: #12211
|
|
|
|
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/
```
|
|
When downloading wrap content, we need to know at some point if the
server is going to respond with "hello, yes, I'm here and I have data
for you". The alternative is to sometimes infinitely hang.
In commit 8f7781f1d6bf36c064b39e7d0794c686f1b78665 we added such a
timeout, but using an extremely generously high number -- ten minutes.
We don't need to wait this long just to find out if the other end
exists, so decrease that time to 30 seconds, whch is still ludicrously
generous but not quite as much so.
|
|
- 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.
|
|
It is a common mistake that is hard to find because Meson silently
ignore unknown sections. Better have an explicit error message.
|
|
patch on Windows is provided by MSYS, which only understands POSIX
paths, with `/`. Using Windows paths with `\` results in a "file not
found" error.
We got a little lucky here because the path is relative, so the drive
letter difference doesn't affect us.
|
|
|
|
This is generally a good idea, and the tempfile is already instructed to
not auto-delete on close. It also fixes a bug on PyPy, where the file
isn't valid because it's not explicitly closed. This is probably due to
the garbage collection modes -- in CPython, the object goes out of scope
and gets automatically closed before we actually attempt to unpack it.
Fixes #11246
|
|
|
|
|
|
Fixes #10931
|
|
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 :)
|
|
This moves the implementation into msubprojects because it has all the
infrastructure to update wraps in parallel while keeping "meson wrap"
UX.
|
|
|
|
If we update e.g. glib.wrap from wrap-git with directory=glib to
wrap-file with directory=glib-2.70 we could still have the glib
directory that is not referenced by any .wrap file any more. We should
still ignore that directory otherwise it overrides the glib.wrap we
parsed.
|
|
Download wrap file from wrapdb automatically when it is not found
locally but we have it in wrapdb.json.
This makes for example `dependency('glib-2.0')` work out of the box
simply by running `meson wrap update-db`, even if the project does not
provide any wraps.
|
|
It downloads releases.json from wrapdb and store it in
subprojects/wrapdb.json. That file will be used by Meson to find
dependency fallbacks offline.
|
|
A subproject could have a sub-subproject as a git submodule, or part of
the subproject's release tarball, and still have a wrap file for it
(e.g. needed for [provide] section). In that case we need to use the
source tree for the sub-subproject inplace instead of downloading a new
copy into the main project.
This is the case with GLib 2.74, it has a subproject "gvdb" as git
submodule, and part of release tarball, it ships gvdb.wrap file as well.
|
|
|
|
It can wait until after parsing the wrap file to set it.
|
|
This does force a number of uses of `# pylint: disable` comments, but it
also finds a couple of useless global uses and one place (in the
previous commit) that an easy refactor removes the use of global. Global
is a code smell, so forcing adding a comment to disable helps force
developers to really consider if what they're doing is a good idea.
|
|
Save off the hash of the wrap file when first configuring a subproject.
When reconfiguring a subproject, check the hash of the wrap file
against the stored hash. If they don't match then warn the user.
|
|
The comment and some settings that appear to be related to the comment
were introduced in f21685a83330a4bbe1e59c3641a0d24f1efe8825 and appears
to be documenting some of the fields added in that commit. This commit
moves the comment back to the field it appears to be documenting.
|
|
When we do wrap resolution, we do a case-insensitive lookup because
keys, i.e. `dep_name = variable_name`, are case insensitive. In order to
check whether we should process a subproject, we need to know if the
lowercased dependency name matches.
We do this by looking up the lowercase name, and assuming that the
stored name is also lowercase. But for dependency_names, this isn't "case
insensitive and stored in lowercase" so we need to manually force it to
be consistent.
Likewise, when looking up the wrap name (which works like
dependency_names and doesn't need a provide section at all) the disk
filename of the wrap file is case sensitive, but needs to be manually
forced for consistency.
|
|
These can just be ordinary strings.
|
|
|
|
When `self.wrap.filesdir` is a relative path, which happens when
`meson subprojects update` is run, the path to the patch must be
provided relative to the working directory in which `patch` or `git`
is run.
`self.wrap.filesdir` is absolute when `Resolve()` is invoked by the
Meson interpreter, which is why this wasn't detected by the tests.
|
|
|
|
Co-authored-by: Xavier Claessens <xavier.claessens@collabora.com>
|
|
|
|
|
|
We currently inconsistently handle connection, `has_ssl`, and printing
errors on urlopen failure between `meson subprojects` and `meson wrap`.
Make the latter work more like the former.
|
|
We have a fallback route in `meson subprojects download` and friends,
which tries to retrieve wrapdb urls via http, if Python was not built
with SSL support.
Stop doing this. Replace it with a command line option to specify that
insecure downloads are wanted, and reference it in the error message if
downloading fails due to SSL issues.
|
|
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.
|