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
pyinstaller considers .py files to not be data by default. The entire
architecture of pyinstaller is, in fact, different from zipapp or
unpacked modules -- because it actually has to use a resource loader
with on-disk files *separate* from the module itself. So just because a
file gets packaged in the application does not mean it's usable as an
importlib.resources compatible resource.
Although we collect data files in general, we need to make sure that .py
files are collected from scripts, because we may try to run them
standalone from an external process.
Fixes#11689
Running pyinstaller to create a bundle, and using the resulting
`pyinst-tmp/meson/meson setup ...` with the cmake module revealed that
no data files were being bundled, unlike what we did for setup.cfg. Fix
this oversight.
Fixes#10163
Make use of pyinstaller hooks by creating a hook that updates how the
`mesonbuild` import functions.
This is more or less the same as passing a bajillion arguments to
pyinstaller's CLI, but allows the logic to be self-contained (and
reusable). It becomes more obvious what parts of the process pertain to
pyinstaller, and which parts pertain to MSI/pkg creation.
Fixes regression in commit 05b5a1e56f.
This added usage of another module in the python module's introspection
of `meson.exe runpython`, but the MSI packaging didn't adapt, causing it
to fail to be detected due to ImportError.
Fixes#9975
We have a lot of these. Some of them are harmless, if unidiomatic, such
as `if (condition)`, others are potentially dangerous `assert(...)`, as
`assert(condtion)` works as expected, but `assert(condition, message)`
will result in an assertion that never triggers, as what you're actually
asserting is `bool(tuple[2])`, which will always be true.
All changes were created by running
"pyupgrade --py3-only --keep-percent-format"
and committing the results. I have not touched string formatting for
now.
- use set literals
- simplify .format() parameter naming
- remove __future__
- remove default "r" mode for open()
- use OSError rather than compatibility aliases
- remove stray parentheses in function(generator) scopes
Invoke create_zipapp.py from the root of the repository and it will
create a minimal zipapp with only the mesonbuild module code and a
__main__.py directly copied from meson.py
The meson.py launcher already tracks the desired entry point, and its
only other effect is to add the mesonbuild directory to the path if it
exists, which it won't in the zipapp. So there's no need to duplicate
this into another __main__.py