summaryrefslogtreecommitdiffstats
path: root/python/mozbuild
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /python/mozbuild
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz
firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'python/mozbuild')
-rw-r--r--python/mozbuild/mozbuild/action/langpack_manifest.py2
-rwxr-xr-xpython/mozbuild/mozbuild/action/xpidl-process.py12
-rw-r--r--python/mozbuild/mozbuild/artifacts.py1
-rw-r--r--python/mozbuild/mozbuild/backend/cpp_eclipse.py6
-rw-r--r--python/mozbuild/mozbuild/backend/mach_commands.py2
-rw-r--r--python/mozbuild/mozbuild/bootstrap.py3
-rw-r--r--python/mozbuild/mozbuild/code_analysis/mach_commands.py2
-rw-r--r--python/mozbuild/mozbuild/codecoverage/chrome_map.py2
-rw-r--r--python/mozbuild/mozbuild/configure/__init__.py9
-rw-r--r--python/mozbuild/mozbuild/configure/check_debug_ranges.py2
-rw-r--r--python/mozbuild/mozbuild/configure/constants.py1
-rw-r--r--python/mozbuild/mozbuild/dotproperties.py2
-rw-r--r--python/mozbuild/mozbuild/frontend/reader.py37
-rw-r--r--python/mozbuild/mozbuild/mach_commands.py22
-rw-r--r--python/mozbuild/mozbuild/preprocessor.py21
-rw-r--r--python/mozbuild/mozbuild/repackaging/msix.py10
-rw-r--r--python/mozbuild/mozbuild/schedules.py1
-rw-r--r--python/mozbuild/mozbuild/test/configure/test_bootstrap.py43
-rw-r--r--python/mozbuild/mozbuild/test/configure/test_checks_configure.py2
-rw-r--r--python/mozbuild/mozbuild/test/configure/test_configure.py66
-rw-r--r--python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py8
-rw-r--r--python/mozbuild/mozbuild/test/frontend/test_reader.py16
-rw-r--r--python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py2
-rw-r--r--python/mozbuild/mozbuild/vendor/vendor_manifest.py2
24 files changed, 212 insertions, 62 deletions
diff --git a/python/mozbuild/mozbuild/action/langpack_manifest.py b/python/mozbuild/mozbuild/action/langpack_manifest.py
index ffe32f567e..6995b12dc1 100644
--- a/python/mozbuild/mozbuild/action/langpack_manifest.py
+++ b/python/mozbuild/mozbuild/action/langpack_manifest.py
@@ -375,7 +375,7 @@ def parse_chrome_manifest(path, base_path, chrome_entries):
###
def get_version_maybe_buildid(app_version):
def _extract_numeric_part(part):
- matches = re.compile("[^\d]").search(part)
+ matches = re.compile(r"[^\d]").search(part)
if matches:
part = part[0 : matches.start()]
if len(part) == 0:
diff --git a/python/mozbuild/mozbuild/action/xpidl-process.py b/python/mozbuild/mozbuild/action/xpidl-process.py
index 0a126c729d..ca71c6543a 100755
--- a/python/mozbuild/mozbuild/action/xpidl-process.py
+++ b/python/mozbuild/mozbuild/action/xpidl-process.py
@@ -14,7 +14,7 @@ import sys
import six
from buildconfig import topsrcdir
from mozpack import path as mozpath
-from xpidl import jsonxpt
+from xpidl import jsonxpt, typescript
from xpidl.header import print_header
from xpidl.rust import print_rust_bindings
from xpidl.rust_macros import print_rust_macros_bindings
@@ -39,6 +39,8 @@ def process(
p = IDLParser()
xpts = []
+ ts_data = []
+
mk = Makefile()
rule = mk.create_rule()
@@ -63,6 +65,7 @@ def process(
rs_bt_path = os.path.join(xpcrs_dir, "bt", "%s.rs" % stem)
xpts.append(jsonxpt.build_typelib(idl))
+ ts_data.append(typescript.ts_source(idl))
rule.add_dependencies(six.ensure_text(s) for s in idl.deps)
@@ -94,6 +97,13 @@ def process(
with open(xpt_path, "w", encoding="utf-8", newline="\n") as fh:
jsonxpt.write(jsonxpt.link(xpts), fh)
+ # NOTE: Make doesn't know about .d.json files, but we can piggy-back
+ # on XPT generation for now, as conceptually they contain the same
+ # information, and should be built together in all cases.
+ ts_path = os.path.join(xpt_dir, f"{module}.d.json")
+ with open(ts_path, "w", encoding="utf-8", newline="\n") as fh:
+ typescript.write(ts_data, fh)
+
rule.add_targets([six.ensure_text(xpt_path)])
if deps_dir:
deps_path = os.path.join(deps_dir, "%s.pp" % module)
diff --git a/python/mozbuild/mozbuild/artifacts.py b/python/mozbuild/mozbuild/artifacts.py
index c82a39694c..a4d186816a 100644
--- a/python/mozbuild/mozbuild/artifacts.py
+++ b/python/mozbuild/mozbuild/artifacts.py
@@ -653,6 +653,7 @@ class MacArtifactJob(ArtifactJob):
"{product}-bin",
"*.dylib",
"minidump-analyzer",
+ "nmhproxy",
"pingsender",
"plugin-container.app/Contents/MacOS/plugin-container",
"updater.app/Contents/MacOS/org.mozilla.updater",
diff --git a/python/mozbuild/mozbuild/backend/cpp_eclipse.py b/python/mozbuild/mozbuild/backend/cpp_eclipse.py
index f2bd5ecd85..04735b702f 100644
--- a/python/mozbuild/mozbuild/backend/cpp_eclipse.py
+++ b/python/mozbuild/mozbuild/backend/cpp_eclipse.py
@@ -171,14 +171,14 @@ class CppEclipseBackend(CommonBackend):
# Here we generate the code formatter that will show up in the UI with
# the name "Mozilla". The formatter is stored as a single line of XML
# in the org.eclipse.cdt.ui.formatterprofiles pref.
- cdt_ui_prefs += """org.eclipse.cdt.ui.formatterprofiles=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\\n<profiles version\="1">\\n<profile kind\="CodeFormatterProfile" name\="Mozilla" version\="1">\\n"""
- XML_PREF_TEMPLATE = """<setting id\="@PREF_NAME@" value\="@PREF_VAL@"/>\\n"""
+ cdt_ui_prefs += r'org.eclipse.cdt.ui.formatterprofiles=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<profiles version\="1">\n<profile kind\="CodeFormatterProfile" name\="Mozilla" version\="1">\n'
+ XML_PREF_TEMPLATE = r'<setting id\="@PREF_NAME@" value\="@PREF_VAL@"/>\n'
for line in FORMATTER_SETTINGS.splitlines():
[pref, val] = line.split("=")
cdt_ui_prefs += XML_PREF_TEMPLATE.replace("@PREF_NAME@", pref).replace(
"@PREF_VAL@", val
)
- cdt_ui_prefs += "</profile>\\n</profiles>\\n"
+ cdt_ui_prefs += r"</profile>\n</profiles>\n"
with open(cdt_ui_prefs_path, "w") as fh:
fh.write(cdt_ui_prefs)
diff --git a/python/mozbuild/mozbuild/backend/mach_commands.py b/python/mozbuild/mozbuild/backend/mach_commands.py
index 3feedefc42..8b0cdd5067 100644
--- a/python/mozbuild/mozbuild/backend/mach_commands.py
+++ b/python/mozbuild/mozbuild/backend/mach_commands.py
@@ -409,7 +409,7 @@ def get_clang_tools(command_context, clang_tools_path):
def prompt_bool(prompt, limit=5):
"""Prompts the user with prompt and requires a boolean value."""
- from distutils.util import strtobool
+ from mach.util import strtobool
for _ in range(limit):
try:
diff --git a/python/mozbuild/mozbuild/bootstrap.py b/python/mozbuild/mozbuild/bootstrap.py
index 60a307145c..a21ad75ee4 100644
--- a/python/mozbuild/mozbuild/bootstrap.py
+++ b/python/mozbuild/mozbuild/bootstrap.py
@@ -37,9 +37,6 @@ def _bootstrap_sandbox():
Path(__file__).parent.parent.parent.parent / "build" / "moz.configure"
)
sandbox.include_file(str(moz_configure / "init.configure"))
- # bootstrap_search_path_order has a dependency on developer_options, which
- # is not defined in init.configure. Its value doesn't matter for us, though.
- sandbox["developer_options"] = sandbox["always"]
sandbox.include_file(str(moz_configure / "bootstrap.configure"))
return sandbox
diff --git a/python/mozbuild/mozbuild/code_analysis/mach_commands.py b/python/mozbuild/mozbuild/code_analysis/mach_commands.py
index a65d35c3cf..b0416679bb 100644
--- a/python/mozbuild/mozbuild/code_analysis/mach_commands.py
+++ b/python/mozbuild/mozbuild/code_analysis/mach_commands.py
@@ -51,7 +51,7 @@ def build_repo_relative_path(abs_path, repo_path):
def prompt_bool(prompt, limit=5):
"""Prompts the user with prompt and requires a boolean value."""
- from distutils.util import strtobool
+ from mach.util import strtobool
for _ in range(limit):
try:
diff --git a/python/mozbuild/mozbuild/codecoverage/chrome_map.py b/python/mozbuild/mozbuild/codecoverage/chrome_map.py
index 79cedd2faf..ca21c9f62b 100644
--- a/python/mozbuild/mozbuild/codecoverage/chrome_map.py
+++ b/python/mozbuild/mozbuild/codecoverage/chrome_map.py
@@ -25,7 +25,7 @@ from mozbuild.frontend.data import (
from .manifest_handler import ChromeManifestHandler
-_line_comment_re = re.compile('^//@line (\d+) "(.+)"$')
+_line_comment_re = re.compile(r'^//@line (\d+) "(.+)"$')
def generate_pp_info(path, topsrcdir):
diff --git a/python/mozbuild/mozbuild/configure/__init__.py b/python/mozbuild/mozbuild/configure/__init__.py
index 5a4edf3fb8..4c95fb08cb 100644
--- a/python/mozbuild/mozbuild/configure/__init__.py
+++ b/python/mozbuild/mozbuild/configure/__init__.py
@@ -49,6 +49,7 @@ class SandboxDependsFunction(object):
def __init__(self, unsandboxed):
self._or = unsandboxed.__or__
self._and = unsandboxed.__and__
+ self._invert = unsandboxed.__invert__
self._getattr = unsandboxed.__getattr__
def __call__(self, *arg, **kwargs):
@@ -70,6 +71,9 @@ class SandboxDependsFunction(object):
)
return self._and(other).sandboxed
+ def __invert__(self):
+ return self._invert().sandboxed
+
def __cmp__(self, other):
raise ConfigureError("Cannot compare @depends functions.")
@@ -117,8 +121,6 @@ class DependsFunction(object):
assert not inspect.isgeneratorfunction(func)
# Allow non-functions when there are no dependencies. This is equivalent
# to passing a lambda that returns the given value.
- if not (inspect.isroutine(func) or not dependencies):
- print(func)
assert inspect.isroutine(func) or not dependencies
self._func = func
self._name = getattr(func, "__name__", None)
@@ -190,6 +192,9 @@ class DependsFunction(object):
assert self.sandbox is other.sandbox
return CombinedDependsFunction(self.sandbox, self.and_impl, (self, other))
+ def __invert__(self):
+ return TrivialDependsFunction(self.sandbox, lambda x: not x, [self])
+
@staticmethod
def and_impl(iterable):
# Applies "and" to all the items of iterable.
diff --git a/python/mozbuild/mozbuild/configure/check_debug_ranges.py b/python/mozbuild/mozbuild/configure/check_debug_ranges.py
index f82624c14f..22c672ec9c 100644
--- a/python/mozbuild/mozbuild/configure/check_debug_ranges.py
+++ b/python/mozbuild/mozbuild/configure/check_debug_ranges.py
@@ -37,7 +37,7 @@ def get_range_length(range, debug_ranges):
given offset."""
length = 0
for line in debug_ranges.splitlines():
- m = re.match("\s*([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)", line)
+ m = re.match(r"\s*([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)", line)
if m and int(m.group(1), 16) == range:
length += 1
return length
diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py
index d69d9c08ef..25f43bb9f8 100644
--- a/python/mozbuild/mozbuild/configure/constants.py
+++ b/python/mozbuild/mozbuild/configure/constants.py
@@ -36,6 +36,7 @@ class OS(EnumString):
"DragonFly",
"FreeBSD",
"GNU",
+ "iOS",
"NetBSD",
"OpenBSD",
"OSX",
diff --git a/python/mozbuild/mozbuild/dotproperties.py b/python/mozbuild/mozbuild/dotproperties.py
index 9b615cc43f..c02e1a794b 100644
--- a/python/mozbuild/mozbuild/dotproperties.py
+++ b/python/mozbuild/mozbuild/dotproperties.py
@@ -38,7 +38,7 @@ class DotProperties:
line = l.strip()
if not line or line.startswith("#"):
continue
- (k, v) = re.split("\s*=\s*", line, 1)
+ (k, v) = re.split(r"\s*=\s*", line, 1)
self._properties[k] = v
def get(self, key, default=None):
diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py
index d0066e1071..8c7dfcdcac 100644
--- a/python/mozbuild/mozbuild/frontend/reader.py
+++ b/python/mozbuild/mozbuild/frontend/reader.py
@@ -831,7 +831,7 @@ class BuildReader(object):
self.config = config
self._log = logging.getLogger(__name__)
- self._read_files = set()
+ self._read_files = {}
self._execution_stack = []
self.finder = finder
@@ -1113,18 +1113,6 @@ class BuildReader(object):
"Reading file: {path}".format(path=path),
)
- if path in self._read_files:
- log(
- self._log,
- logging.WARNING,
- "read_already",
- {"path": path},
- "File already read. Skipping: {path}".format(path=path),
- )
- return
-
- self._read_files.add(path)
-
time_start = time.monotonic()
topobjdir = config.topobjdir
@@ -1132,6 +1120,20 @@ class BuildReader(object):
relpath = mozpath.relpath(path, config.topsrcdir)
reldir = mozpath.dirname(relpath)
+ # NOTE: descend case is handled in the loop below.
+ if not descend:
+ if relpath in self._read_files:
+ log(
+ self._log,
+ logging.WARNING,
+ "read_already",
+ {"path": path},
+ "File already read. Skipping: {path}".format(path=path),
+ )
+ return
+
+ self._read_files[relpath] = (relpath, "")
+
if mozpath.dirname(relpath) == "js/src" and not config.substs.get(
"JS_STANDALONE"
):
@@ -1234,6 +1236,15 @@ class BuildReader(object):
if not descend:
continue
+ child_relpath = mozpath.relpath(child_path, self.config.topsrcdir)
+
+ if child_relpath in self._read_files:
+ (prev_parent, prev_path) = self._read_files[child_relpath]
+ raise Exception(
+ f"File already read. A directory should not be added to DIRS twice: {child_relpath} is referred from {prev_parent} as '{prev_path}', and {relpath} as '{path}'"
+ )
+ self._read_files[child_relpath] = (relpath, path)
+
for res in self.read_mozbuild(
child_path, context.config, metadata=child_metadata
):
diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py
index 38723f4e0f..2398f8de03 100644
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -2621,6 +2621,13 @@ def repackage_msi(
help="Sign repackaged MSIX with self-signed certificate for local testing. "
"(Default: false)",
)
+@CommandArgument(
+ "--unsigned",
+ default=False,
+ action="store_true",
+ help="Support `Add-AppxPackage ... -AllowUnsigned` on Windows 11."
+ "(Default: false)",
+)
def repackage_msix(
command_context,
input,
@@ -2636,6 +2643,7 @@ def repackage_msix(
output=None,
makeappx=None,
sign=False,
+ unsigned=False,
):
from mozbuild.repackaging.msix import repackage_msix
@@ -2700,6 +2708,20 @@ def repackage_msix(
)
return 1
+ if unsigned:
+ if sign:
+ command_context.log(
+ logging.ERROR,
+ "repackage-msix-signed-and-unsigned",
+ {},
+ "--sign and --unsigned are mutually exclusive",
+ )
+ return 1
+
+ # Support `Add-AppxPackage ... -AllowUnsigned` on Windows 11. See
+ # https://github.com/MicrosoftDocs/msix-docs/blob/769dee9364df2b6fd0b78000774f8d14de8fe814/msix-src/package/unsigned-package.md.
+ publisher = f"{publisher}, OID.2.25.311729368913984317654407730594956997722=1"
+
output = repackage_msix(
input,
command_context.topsrcdir,
diff --git a/python/mozbuild/mozbuild/preprocessor.py b/python/mozbuild/mozbuild/preprocessor.py
index c81357efa4..b3a82a060c 100644
--- a/python/mozbuild/mozbuild/preprocessor.py
+++ b/python/mozbuild/mozbuild/preprocessor.py
@@ -29,7 +29,6 @@ import re
import sys
from optparse import OptionParser
-import six
from mozpack.path import normsep
from mozbuild.makeutil import Makefile
@@ -50,9 +49,11 @@ def _to_text(a):
# We end up converting a lot of different types (text_type, binary_type,
# int, etc.) to Unicode in this script. This function handles all of those
# possibilities.
- if isinstance(a, (six.text_type, six.binary_type)):
- return six.ensure_text(a)
- return six.text_type(a)
+ if isinstance(a, bytes):
+ return a.decode()
+ if isinstance(a, str):
+ return a
+ return str(a)
def path_starts_with(path, prefix):
@@ -540,9 +541,7 @@ class Preprocessor:
self.processFile(input=input_, output=out)
if depfile:
mk = Makefile()
- mk.create_rule([six.ensure_text(options.output)]).add_dependencies(
- self.includes
- )
+ mk.create_rule([options.output]).add_dependencies(self.includes)
mk.dump(depfile)
depfile.close()
@@ -712,7 +711,7 @@ class Preprocessor:
except Exception:
# XXX do real error reporting
raise Preprocessor.Error(self, "SYNTAX_ERR", args)
- if isinstance(val, six.text_type) or isinstance(val, six.binary_type):
+ if isinstance(val, (str, bytes)):
# we're looking for a number value, strings are false
val = False
if not val:
@@ -802,7 +801,7 @@ class Preprocessor:
for i in range(1, len(lst), 2):
lst[i] = vsubst(lst[i])
lst.append("\n") # add back the newline
- self.write(six.moves.reduce(lambda x, y: x + y, lst, ""))
+ self.write("".join(lst))
def do_literal(self, args):
self.write(args + "\n")
@@ -863,7 +862,7 @@ class Preprocessor:
args can either be a file name, or a file-like object.
Files should be opened, and will be closed after processing.
"""
- isName = isinstance(args, six.string_types)
+ isName = isinstance(args, str)
oldCheckLineNumbers = self.checkLineNumbers
self.checkLineNumbers = False
if isName:
@@ -895,7 +894,7 @@ class Preprocessor:
else:
abspath = os.path.abspath(args.name)
self.curdir = os.path.dirname(abspath)
- self.includes.add(six.ensure_text(abspath))
+ self.includes.add(abspath)
if self.topobjdir and path_starts_with(abspath, self.topobjdir):
abspath = "$OBJDIR" + normsep(abspath[len(self.topobjdir) :])
elif self.topsrcdir and path_starts_with(abspath, self.topsrcdir):
diff --git a/python/mozbuild/mozbuild/repackaging/msix.py b/python/mozbuild/mozbuild/repackaging/msix.py
index 762a33f1d1..0836ffb87a 100644
--- a/python/mozbuild/mozbuild/repackaging/msix.py
+++ b/python/mozbuild/mozbuild/repackaging/msix.py
@@ -813,7 +813,7 @@ def _sign_msix_win(output, force, log, verbose):
thumbprint.strip()
for thumbprint in powershell(
(
- "Get-ChildItem -Path Cert:\CurrentUser\My"
+ r"Get-ChildItem -Path Cert:\CurrentUser\My"
'| Where-Object {{$_.Subject -Match "{}"}}'
'| Where-Object {{$_.FriendlyName -Match "{}"}}'
"| Select-Object -ExpandProperty Thumbprint"
@@ -838,7 +838,7 @@ def _sign_msix_win(output, force, log, verbose):
(
'New-SelfSignedCertificate -Type Custom -Subject "{}" '
'-KeyUsage DigitalSignature -FriendlyName "{}"'
- " -CertStoreLocation Cert:\CurrentUser\My"
+ r" -CertStoreLocation Cert:\CurrentUser\My"
' -TextExtension @("2.5.29.37={{text}}1.3.6.1.5.5.7.3.3", '
'"2.5.29.19={{text}}")'
"| Select-Object -ExpandProperty Thumbprint"
@@ -856,7 +856,7 @@ def _sign_msix_win(output, force, log, verbose):
)
powershell(
- 'Export-Certificate -Cert Cert:\CurrentUser\My\{} -FilePath "{}"'.format(
+ r'Export-Certificate -Cert Cert:\CurrentUser\My\{} -FilePath "{}"'.format(
thumbprint, crt_path
)
)
@@ -869,7 +869,7 @@ def _sign_msix_win(output, force, log, verbose):
powershell(
(
- 'Export-PfxCertificate -Cert Cert:\CurrentUser\My\{} -FilePath "{}"'
+ r'Export-PfxCertificate -Cert Cert:\CurrentUser\My\{} -FilePath "{}"'
' -Password (ConvertTo-SecureString -String "{}" -Force -AsPlainText)'
).format(thumbprint, pfx_path, password)
)
@@ -940,7 +940,7 @@ def _sign_msix_win(output, force, log, verbose):
root_thumbprints = [
root_thumbprint.strip()
for root_thumbprint in powershell(
- "Get-ChildItem -Path Cert:\LocalMachine\Root\{} "
+ r"Get-ChildItem -Path Cert:\LocalMachine\Root\{} "
"| Select-Object -ExpandProperty Thumbprint".format(thumbprint),
check=False,
).splitlines()
diff --git a/python/mozbuild/mozbuild/schedules.py b/python/mozbuild/mozbuild/schedules.py
index 5f484ed377..0b7d9b1154 100644
--- a/python/mozbuild/mozbuild/schedules.py
+++ b/python/mozbuild/mozbuild/schedules.py
@@ -42,6 +42,7 @@ EXCLUSIVE_COMPONENTS = [
"linux",
"macosx",
"windows",
+ "ios",
# broad test harness categories
"awsy",
"condprofile",
diff --git a/python/mozbuild/mozbuild/test/configure/test_bootstrap.py b/python/mozbuild/mozbuild/test/configure/test_bootstrap.py
index 758ddd5632..e3e3d3c744 100644
--- a/python/mozbuild/mozbuild/test/configure/test_bootstrap.py
+++ b/python/mozbuild/mozbuild/test/configure/test_bootstrap.py
@@ -37,7 +37,6 @@ class TestBootstrap(BaseConfigureTest):
# - `in_path` is a 3-tuple representing whether the path for each toolchain is
# expected to have been added to the `bootstrap_search_path`. Valid values are:
# - `True`: the toolchain path was prepended to `bootstrap_search_path`.
- # - `"append"`: the toolchain path was appended to `bootstrap_search_path`.
# - `False`: the toolchain path is not in `bootstrap_search_path`.
def assertBootstrap(self, arg, states, bootstrapped, in_path):
called_for = []
@@ -119,7 +118,7 @@ class TestBootstrap(BaseConfigureTest):
"--disable-bootstrap",
(True, "old", False),
(False, False, False),
- (True, True, False),
+ (False, False, False),
)
self.assertBootstrap(
None,
@@ -133,13 +132,13 @@ class TestBootstrap(BaseConfigureTest):
"--disable-bootstrap",
(True, "old", False),
(False, False, False),
- ("append", "append", False),
+ (False, False, False),
)
self.assertBootstrap(
None,
(True, "old", False),
(False, False, False),
- ("append", "append", False),
+ (True, True, False),
)
for milestone in ("124.0a1", "124.0"):
@@ -151,6 +150,12 @@ class TestBootstrap(BaseConfigureTest):
(False, True, True),
(True, True, True),
)
+ self.assertBootstrap(
+ "--enable-bootstrap=no-update",
+ (True, "old", False),
+ (False, False, True),
+ (True, True, True),
+ )
# With `--enable-bootstrap=foo,bar`, only foo and bar are bootstrappable
self.assertBootstrap(
@@ -163,7 +168,19 @@ class TestBootstrap(BaseConfigureTest):
"--enable-bootstrap=foo",
(True, "old", True),
(False, False, False),
- (True, "append", "append"),
+ (True, True, True),
+ )
+ self.assertBootstrap(
+ "--enable-bootstrap=no-update,foo,bar",
+ (False, "old", False),
+ (True, False, False),
+ (True, True, False),
+ )
+ self.assertBootstrap(
+ "--enable-bootstrap=no-update,foo",
+ (True, "old", True),
+ (False, False, False),
+ (True, True, True),
)
# With `--enable-bootstrap=-foo`, anything is bootstrappable, except foo
@@ -171,7 +188,7 @@ class TestBootstrap(BaseConfigureTest):
"--enable-bootstrap=-foo",
(True, False, "old"),
(False, True, True),
- ("append", True, True),
+ (True, True, True),
)
self.assertBootstrap(
"--enable-bootstrap=-foo",
@@ -179,13 +196,25 @@ class TestBootstrap(BaseConfigureTest):
(False, True, True),
(False, True, True),
)
+ self.assertBootstrap(
+ "--enable-bootstrap=no-update,-foo",
+ (True, False, "old"),
+ (False, True, False),
+ (True, True, True),
+ )
+ self.assertBootstrap(
+ "--enable-bootstrap=no-update,-foo",
+ (False, False, "old"),
+ (False, True, False),
+ (False, True, True),
+ )
# Corner case.
self.assertBootstrap(
"--enable-bootstrap=-foo,foo,bar",
(False, False, "old"),
(False, True, False),
- (False, True, "append"),
+ (False, True, True),
)
diff --git a/python/mozbuild/mozbuild/test/configure/test_checks_configure.py b/python/mozbuild/mozbuild/test/configure/test_checks_configure.py
index 3482f82f3d..131ac5aa7b 100644
--- a/python/mozbuild/mozbuild/test/configure/test_checks_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_checks_configure.py
@@ -592,7 +592,7 @@ class TestChecksConfigure(unittest.TestCase):
javac = mozpath.abspath("/usr/bin/javac")
paths = {java: None, javac: None}
expected_error_message = (
- "ERROR: Could not locate Java at /mozbuild/jdk/jdk-17.0.9+9/bin, "
+ "ERROR: Could not locate Java at /mozbuild/jdk/jdk-17.0.10+7/bin, "
"please run ./mach bootstrap --no-system-changes\n"
)
diff --git a/python/mozbuild/mozbuild/test/configure/test_configure.py b/python/mozbuild/mozbuild/test/configure/test_configure.py
index d075477a44..a63ad9a15c 100644
--- a/python/mozbuild/mozbuild/test/configure/test_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_configure.py
@@ -1921,6 +1921,72 @@ class TestConfigure(unittest.TestCase):
):
self.get_config(["--enable-when"])
+ def test_depends_unary_ops_func(self):
+ with self.moz_configure(
+ """
+ option('--foo', nargs=1, help='foo')
+ @depends('--foo')
+ def foo(value):
+ return value
+ set_config('Foo', foo)
+ set_config('notFoo', depends(foo)(lambda x: not x))
+ set_config('invFoo', ~foo)
+ """
+ ):
+ foo_opt, foo_value = "--foo=foo", PositiveOptionValue(("foo",))
+
+ config = self.get_config([foo_opt])
+ self.assertEqual(
+ config,
+ {
+ "Foo": foo_value,
+ "notFoo": not foo_value,
+ "invFoo": not foo_value,
+ },
+ )
+
+ foo_value = False
+ config = self.get_config([])
+ self.assertEqual(
+ config,
+ {
+ "Foo": foo_value,
+ "notFoo": not foo_value,
+ "invFoo": not foo_value,
+ },
+ )
+
+ def test_depends_unary_ops_val(self):
+ with self.moz_configure(
+ """
+ option("--cond", help="condition")
+ cond = depends("--cond")(lambda c: c)
+ foo = depends(when=cond)("foo")
+ set_config('Foo', foo)
+ set_config('notFoo', depends(foo)(lambda x: not x))
+ set_config('invFoo', ~foo)
+
+ bar = depends(when=~cond)("bar")
+ bar2 = depends(when=depends(cond)(lambda c: not c))("bar2")
+ set_config('Bar', bar)
+ set_config('Bar2', bar2)
+ """
+ ):
+ config = self.get_config(["--cond"])
+ self.assertEqual(
+ config,
+ {
+ "Foo": "foo",
+ "notFoo": not "foo",
+ "invFoo": not "foo",
+ },
+ )
+ config = self.get_config([])
+ self.assertEqual(
+ config,
+ {"notFoo": True, "invFoo": True, "Bar": "bar", "Bar2": "bar2"},
+ )
+
def test_depends_binary_ops(self):
with self.moz_configure(
"""
diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py
index f42778215b..f9e4840aa7 100644
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py
@@ -22,16 +22,16 @@ class CompilerPreprocessor(Preprocessor):
# For now, we don't look very hard for C strings because they don't matter
# that much for our unit tests, but we at least avoid expanding in the
# simple "FOO" case.
- VARSUBST = re.compile('(?<!")(?P<VAR>\w+)(?!")', re.U)
- NON_WHITESPACE = re.compile("\S")
+ VARSUBST = re.compile(r'(?<!")(?P<VAR>\w+)(?!")', re.U)
+ NON_WHITESPACE = re.compile(r"\S")
HAS_FEATURE_OR_BUILTIN = re.compile(
- '(__has_(?:feature|builtin|attribute|warning))\("?([^"\)]*)"?\)'
+ r'(__has_(?:feature|builtin|attribute|warning))\("?([^"\)]*)"?\)'
)
def __init__(self, *args, **kwargs):
Preprocessor.__init__(self, *args, **kwargs)
self.do_filter("c_substitution")
- self.setMarker("#\s*")
+ self.setMarker(r"#\s*")
def do_if(self, expression, **kwargs):
# The C preprocessor handles numbers following C rules, which is a
diff --git a/python/mozbuild/mozbuild/test/frontend/test_reader.py b/python/mozbuild/mozbuild/test/frontend/test_reader.py
index a15bb15d7e..91d453a21f 100644
--- a/python/mozbuild/mozbuild/test/frontend/test_reader.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_reader.py
@@ -83,12 +83,20 @@ class TestBuildReader(unittest.TestCase):
contexts = list(reader.read_topsrcdir())
self.assertEqual(len(contexts), 3)
- def test_repeated_dirs_ignored(self):
- # Ensure repeated directories are ignored.
+ def test_repeated_dirs_error(self):
reader = self.reader("traversal-repeated-dirs")
- contexts = list(reader.read_topsrcdir())
- self.assertEqual(len(contexts), 3)
+ with self.assertRaises(BuildReaderError) as bre:
+ list(reader.read_topsrcdir())
+
+ e = bre.exception
+ self.assertEqual(
+ e.actual_file, self.file_path("traversal-repeated-dirs", "bar", "moz.build")
+ )
+ self.assertIn(
+ "File already read. A directory should not be added to DIRS twice: foo/moz.build is referred from moz.build as 'foo', and bar/moz.build as '../foo'",
+ str(e),
+ )
def test_outside_topsrcdir(self):
# References to directories outside the topsrcdir should fail.
diff --git a/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py b/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py
index 8163c05dc3..5434510bb0 100644
--- a/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py
+++ b/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py
@@ -822,7 +822,7 @@ def edit_moz_build_file_to_remove_file(
"""
simple_file_line = re.compile(
- "^\s*['\"]" + unnormalized_filename_to_remove + "['\"],*$"
+ "^\\s*['\"]" + unnormalized_filename_to_remove + "['\"],*$"
)
did_replace = False
diff --git a/python/mozbuild/mozbuild/vendor/vendor_manifest.py b/python/mozbuild/mozbuild/vendor/vendor_manifest.py
index 65ee161348..ad9564405e 100644
--- a/python/mozbuild/mozbuild/vendor/vendor_manifest.py
+++ b/python/mozbuild/mozbuild/vendor/vendor_manifest.py
@@ -612,7 +612,7 @@ class VendorManifest(MozbuildObject):
if r[0] in l:
print("Found " + l)
replaced += 1
- yaml[i] = re.sub(r[0] + " [v\.a-f0-9]+.*$", r[0] + r[1], yaml[i])
+ yaml[i] = re.sub(r[0] + r" [v\.a-f0-9]+.*$", r[0] + r[1], yaml[i])
assert len(replacements) == replaced