The install command was failing with 'Namespace object has no
attribute args' error because the argument parser for the
install command was missing the 'args' parameter that allows
passing additional arguments to the build system.
This fix adds the missing argument to match the behavior of
other commands like build, run, and debug.
On my Linux machine with 32 cores, ninja actually defaults to 34 jobs.
By defaulting ourselves to multiprocessing.cpu_count(), we actually
decrease the number of jobs used.
We don't need to pick a host compiler every time ladybird.py is invoked.
We only need to do so when configuring the Build directory.
This shaves about 10ms off an invocation of `ladybird.py build` on my
machine, going from ~170ms to ~160ms.
By default, we want `ladybird.py build` to build everything. We were
previously defaulting to only building the Ladybird target.
We now only fall back to the Ladybird target for commands that run a
program. So `ladybird.py run` will build and run Ladybird.
As opposed to just running subprocess.check_call, our `run_command`
utility handles e.g. ctrl+c to avoid spamming the terminal with
KeyboardInterrupt stack traces.
This is the default python version on macOS, so let's support it since
it is trivial for now. Using "str | None" as a type annotation is only
supported in python 3.10 or later.
This will be needed by other scripts.
To do so, this patch gives up on the importlib method of importing
packages. I tried extracting this helper to e.g. __init__.py, but the
python runtime was unable to find the imported symbols.
The previous commit preserved existing behavior from `master`, but made
it clear that the script was trying to use the `run` arguments in the
build step. We currently cannot specify both build-time and run-time
arguments, so only pass the positional arguments to the run step.
There's no measurable benefit to hiding these in functions, even if they
are only used once (or not at all). Only the BuildVcpkg import is left
alone, as that function does some sys.path manipulation first.
These are meant to indicate private functions by convention, and while
we can argue these functions are "private" to this file, let's err on
the side of readablilty over every single function being prefixed.
We require pep8 conformance via flake8 in CI, and flake8 seems happy
with this patch. In the future, we should enforce use of black in CI
as well.
Formatted with:
black --line-length 120 ./Meta/ladybird.py