# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
import ctypes import os import platform import subprocess import sys from pathlib import Path
from mozbuild.buildversion import mozilla_build_version from packaging.version import Version
from mozboot.base import BaseBootstrapper
def is_aarch64_host(): from ctypes import wintypes
gotValue = iswow64process2(
currentProcess, ctypes.byref(processMachine), ctypes.byref(nativeMachine)
) # If this call fails, we have no idea. ifnot gotValue: returnFalse
paths = [] try: with winreg.OpenKeyEx(
winreg.HKEY_LOCAL_MACHINE,
r"SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths",
) as exclusions_key:
_, values_count, __ = winreg.QueryInfoKey(exclusions_key) for i in range(0, values_count):
path, _, __ = winreg.EnumValue(exclusions_key, i)
paths.append(Path(path)) except FileNotFoundError: pass
return paths
def is_windefender_affecting_srcdir(src_dir: Path): if get_is_windefender_disabled(): returnFalse
# When there's a match, but path cases aren't the same between srcdir and exclusion_path, # commonpath will use the casing of the first path provided. # To avoid surprises here, we normcase(...) so we don't get unexpected breakage if we change # the path order.
src_dir = src_dir.resolve()
try:
exclusion_paths = get_windefender_exclusion_paths() except OSError as e: if e.winerror == 5: # A version of Windows 10 released in 2021 raises an "Access is denied" # error (ERROR_ACCESS_DENIED == 5) to un-elevated processes when they # query Windows Defender's exclusions. Skip the exclusion path checking. return raise
for exclusion_path in exclusion_paths:
exclusion_path = exclusion_path.resolve() try: if Path(os.path.commonpath((exclusion_path, src_dir))) == exclusion_path: # exclusion_path is an ancestor of srcdir returnFalse except ValueError: # ValueError: Paths don't have the same drive - can't be ours pass returnTrue
class MozillaBuildBootstrapper(BaseBootstrapper): """Bootstrapper for MozillaBuild to install rustup."""
def validate_environment(self): if is_windefender_affecting_srcdir(self.srcdir):
print( "Warning: the Firefox checkout directory is currently not in the " "Windows Defender exclusion list. This can cause the build process " "to be dramatically slowed or broken. To resolve this, follow the " "directions here: " "https://firefox-source-docs.mozilla.org/setup/windows_build.html" "#antivirus-performance",
file=sys.stderr,
)
def install_system_packages(self): pass
def upgrade_mercurial(self, current): # Mercurial upstream sometimes doesn't upload wheels, and building # from source requires MS Visual C++ 9.0. So we force pip to install # the last version that comes with wheels. if mozilla_build_version() >= Version("4.0"):
pip_dir = (
Path(os.environ["MOZILLABUILD"]) / "python3" / "Scripts" / "pip.exe"
) else:
pip_dir = (
Path(os.environ["MOZILLABUILD"]) / "python" / "Scripts" / "pip.exe"
)
def _os_arch(self):
os_arch = platform.machine() if os_arch == "AMD64": # On Windows, x86_64 is reported as AMD64 but we use x86_64 # everywhere else, so let's normalized it here. return"x86_64" return os_arch
def install_mobile_android_packages(self, mozconfig_builder, artifact_mode=False): from mozboot import android
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.