Bug 1842918 - normalize away spaces in `$(PYTHON3)` r=firefox-build-system-reviewers,glandium

As of bug 1838763, Python virtualenvs are now located in a subdirectory
of `$MOZBUILD_STATE_PATH`. This, in turn, defaults to a subdirectory of
the home directory, which on Windows often contains spaces.

The Windows build instructions were updated to add a requirement that
`MOZBUILD_STATE_PATH` not contain spaces, under the assumption that this
was merely a clarification of an existing restriction; but this is
indeed a new requirement and breaks existing setups.

Instead, allow makefiles to safely invoke `$(PYTHON3)` without quoting
it everywhere (as they do) by ensuring that its value contains no
spaces, by using the DOS-style (8.3) short path to the Python
executable.

Additionally, clarify in the documentation exactly which paths are
required not to contain spaces.

Differential Revision: https://phabricator.services.mozilla.com/D183305
This commit is contained in:
Ray Kraesig 2023-07-13 13:29:57 +00:00
Родитель e39b0c81fd
Коммит 72acfa071a
2 изменённых файлов: 6 добавлений и 14 удалений

Просмотреть файл

@ -172,7 +172,7 @@ def virtualenv_python3():
return namespace(
# sys.executable is currently not updated for in-process activations. However,
# sys.prefix is, so we can calculate the python executable's path from there.
path=normsep(PythonVirtualenv(realpath(sys.prefix)).python_path),
path=normalize_path(PythonVirtualenv(realpath(sys.prefix)).python_path),
str_version=".".join(str(i) for i in sys.version_info[0:3]),
)

Просмотреть файл

@ -151,19 +151,11 @@ they may be resolved by `upgrading your MozillaBuild <https://wiki.mozilla.org/M
Spaces in folder names
~~~~~~~~~~~~~~~~~~~~~~
**Firefox will not build** if the path to the installation
tool folders contains **spaces** or other breaking characters such as
pluses, quotation marks, or metacharacters. The Visual Studio tools and
SDKs are an exception - they may be installed in a directory which
contains spaces. It is strongly recommended that you accept the default
settings for all installation locations.
If your Windows username contains a space, the default ``.mozbuild`` path
will also contain a space. You will need to move where ``.mozbuild`` directory
lives by setting the ``MOZBUILD_STATE_PATH`` environment variable to a location
without a space in the path (eg: ``MOZBUILD_STATE_PATH=C:\.mozbuild``). If your
``.mozbuild`` already contains bootstrapped dependencies, you should copy or move it
to that new location, otherwise you will need to run ``./mach bootstrap`` again.
**Firefox will not build** if the path to MozillaBuild or the Firefox source
contain **spaces** or other breaking characters such as pluses, quotation marks,
or metacharacters. The Visual Studio tools and SDKs are an exception - they may
be installed in a directory which contains spaces. It is strongly recommended
that you accept the default settings for all installation locations.
Quotation marks in ``PATH``
~~~~~~~~~~~~~~~~~~~~~~~~~~~