Bug 1793550 - Make the homebrew python 3.10 problem immediately visible. r=firefox-build-system-reviewers,andi

The problem only happens with homebrew (python.org's build doesn't have
the problem). Many people are hitting it, and we might as well avoid
them the trouble to have to find the documentation and just fail
directly.

Differential Revision: https://phabricator.services.mozilla.com/D158546
This commit is contained in:
Mike Hommey 2022-10-04 06:50:17 +00:00
Родитель ae8d7756c6
Коммит 46e4b776b5
2 изменённых файлов: 15 добавлений и 19 удалений

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

@ -166,22 +166,3 @@ should install:
ac_add_options --with-macos-sdk=$HOME/.mozbuild/macos-sdk/MacOSX11.3.sdk
5. Now, you should be able to successfully run ``./mach build``.
"FileNotFoundError" with some stuff about _virtualenvs and site-packages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You likely have Python 3.10 installed (Brew or XCode may have done this -- We're not sure how it happens). There is
a bug in `virtualenv` that prevents us from even setting up the virtual environment.
Uninstall it with the following:
.. code-block:: shell
brew unlink python@3.10
If you need Python 3.10, you can re-link it after the fact with
.. code-block:: shell
brew link python@3.10

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

@ -77,6 +77,21 @@ def main(args):
""").strip())
sys.exit(1)
if sys.version_info >= (3, 10) and sys.platform.startswith("darwin"):
version = f"{sys.version_info[0]}.{sys.version_info[1]}"
if f"python@{version}" in sys.executable:
print(dedent(f"""
You are using python {version} from homebrew.
There is a bug in virtualenv that prevents us from starting up mach in that situation.
Please uninstall it with the following and try again:
brew unlink python@{version}
If you need python {version} later, you can re-link it with:
brew link python@{version}
""").strip())
sys.exit(1)
# XCode python sets __PYVENV_LAUNCHER__, which overrides the executable
# used when a python subprocess is created. This is an issue when we want
# to run using our virtualenv python executables.