Issue #3038 - Fix ccache builds and clean up Python 3.14 warning spew.

None of these resulted in build bustage using our default configuration,
but apparently ccache builds were broken due to a bytes/text issue. Wish
the original reporter had mentioned he was using ccache, but he saved me
a lot of busywork. Changes appear safe across whole range of Python
versions we support.
This commit is contained in:
Jeremy Andrews committed 2026-04-08 02:31:52 -05:00
1 parent 71a061f3ea
commit 3b0aadb95c
23 files changed
+55 -54

No files matched your search

+1 -1
View File
@@ -4679,7 +4679,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
declArgs=declArgs)
def incrementNestingLevel():
if nestingLevel is "":
if nestingLevel == "":
return 1
return nestingLevel + 1
+1 -1
View File
@@ -31,7 +31,7 @@ def generate(output, idlFilename, preprocessorHeader):
# Unfortunately, even some of the getters here are fallible
# (e.g. on nsComputedDOMStyle).
extendedAttrs = ["Throws"]
if pref is not "":
if pref != "":
extendedAttrs.append('Pref="%s"' % pref)
# webkit properties get a capitalized "WebkitFoo" accessor (added here)
+1 -1
View File
@@ -122,7 +122,7 @@ def preprocess(cxx, preprocessorOption, source, args = []):
def messages(jsmsg):
defines = []
for line in open(jsmsg):
match = re.match("MSG_DEF\((JSMSG_(\w+))", line)
match = re.match(r"MSG_DEF\((JSMSG_(\w+))", line)
if match:
defines.append("#define %s %i" % (match.group(1), len(defines)))
else:
+3 -3
View File
@@ -47,7 +47,7 @@ def get_properties(preprocessorHeader):
def generate_idl_names(properties):
names = []
for p in properties:
if p["proptype"] is "alias":
if p["proptype"] == "alias":
continue
if p["idlname"] is None:
names.append(" nullptr, // %s" % p["name"])
@@ -57,7 +57,7 @@ def generate_idl_names(properties):
def generate_assertions(properties):
def enum(p):
if p["proptype"] is "alias":
if p["proptype"] == "alias":
return "eCSSPropertyAlias_%s" % p["prop"]
else:
return "eCSSProperty_%s" % p["id"]
@@ -67,7 +67,7 @@ def generate_assertions(properties):
def generate_idl_name_positions(properties):
# Skip aliases.
ps = [p for p in properties if p["proptype"] is not "alias"]
ps = [p for p in properties if p["proptype"] != "alias"]
# Sort alphabetically by IDL name.
ps = sorted(ps, key=lambda p: p["idlname"] or "")
@@ -1187,7 +1187,7 @@ def LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key):
if variable_name in variables:
# If the variable is already set, don't set it.
continue
if the_dict_key is 'variables' and variable_name in the_dict:
if the_dict_key == 'variables' and variable_name in the_dict:
# If the variable is set without a % in the_dict, and the_dict is a
# variables dict (making |variables| a varaibles sub-dict of a
# variables dict), use the_dict's definition.
@@ -40,7 +40,7 @@ def process_define_file(output, input):
mozpath.join(topobjdir, 'js', 'src', 'config.status'))
with open(path, 'r') as input:
r = re.compile('^\s*#\s*(?P<cmd>[a-z]+)(?:\s+(?P<name>\S+)(?:\s+(?P<value>\S+))?)?', re.U)
r = re.compile(r'^\s*#\s*(?P<cmd>[a-z]+)(?:\s+(?P<name>\S+)(?:\s+(?P<value>\S+))?)?', re.U)
for l in input:
m = r.match(l)
if m:
@@ -154,7 +154,7 @@ DEPRECATED_VARIABLES_MESSAGE = (
def make_quote(s):
return s.replace('#', '\#').replace('$', '$$')
return s.replace('#', r'\#').replace('$', '$$')
class BackendMakeFile(object):
@@ -784,7 +784,7 @@ class RecursiveMakeBackend(CommonBackend):
'tools'):
if t not in content:
continue
if t == 'tools' and not re.search('(?:^|\s)tools.*::', content, re.M):
if t == 'tools' and not re.search(r'(?:^|\s)tools.*::', content, re.M):
continue
if objdir == self.environment.topobjdir:
continue
@@ -697,7 +697,7 @@ class ConfigureSandbox(dict):
self._templates.add(wrapper)
return wrapper
RE_MODULE = re.compile('^[a-zA-Z0-9_\.]+$')
RE_MODULE = re.compile(r'^[a-zA-Z0-9_\.]+$')
def imports_impl(self, _import, _from=None, _as=None):
'''Implementation of @imports.
@@ -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
@@ -45,7 +45,7 @@ def get_range_length(range, debug_ranges):
def main(bin, compilation_unit):
p = subprocess.Popen(['objdump', '-W', bin], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
(out, err) = p.communicate()
sections = re.split('\n(Contents of the|The section) ', out)
sections = re.split(r'\n(Contents of the|The section) ', out)
debug_info = [s for s in sections if s.startswith('.debug_info')]
debug_ranges = [s for s in sections if s.startswith('.debug_ranges')]
if not debug_ranges or not debug_info:
@@ -461,6 +461,7 @@ class BuildMonitor(MozbuildObject):
try:
ccache = which.which('ccache')
output = subprocess.check_output([ccache, '-s'])
output = output.decode('utf-8', errors='replace')
ccache_stats = CCacheStats(output)
except which.WhichError:
pass
+1 -1
View File
@@ -1445,7 +1445,7 @@ VARIABLES = {
"""Names of example WebIDL interfaces to build as part of the build.
Names in this list correspond to WebIDL interface names defined in
WebIDL files included in the build from one of the \*WEBIDL_FILES
WebIDL files included in the build from one of the \\*WEBIDL_FILES
variables.
"""),
+6 -6
View File
@@ -97,8 +97,8 @@ class DeprecatedJarManifest(Exception): pass
class JarManifestParser(object):
ignore = re.compile('\s*(\#.*)?$')
jarline = re.compile('''
ignore = re.compile(r'\s*(\#.*)?$')
jarline = re.compile(r'''
(?:
(?:\[(?P<base>[\w\d.\-\_\\\/{}@]+)\]\s*)? # optional [base/path]
(?P<jarfile>[\w\d.\-\_\\\/{}]+).jar\: # filename.jar:
@@ -106,11 +106,11 @@ class JarManifestParser(object):
(?:\s*(\#.*)?) # comment
)\s*$ # whitespaces
''', re.VERBOSE)
relsrcline = re.compile('relativesrcdir\s+(?P<relativesrcdir>.+?):')
regline = re.compile('\%\s+(.*)$')
entryre = '(?P<optPreprocess>\*)?(?P<optOverwrite>\+?)\s+'
relsrcline = re.compile(r'relativesrcdir\s+(?P<relativesrcdir>.+?):')
regline = re.compile(r'\%\s+(.*)$')
entryre = r'(?P<optPreprocess>\*)?(?P<optOverwrite>\+?)\s+'
entryline = re.compile(entryre
+ '(?P<output>[\w\d.\-\_\\\/\+\@]+)\s*(\((?P<locale>\%?)(?P<source>[\w\d.\-\_\\\/\@\*]+)\))?\s*$'
+ r'(?P<output>[\w\d.\-\_\\\/\+\@]+)\s*(\((?P<locale>\%?)(?P<source>[\w\d.\-\_\\\/\@\*]+)\))?\s*$'
)
def __init__(self):
+1 -1
View File
@@ -61,7 +61,7 @@ class MozconfigLoadException(Exception):
class MozconfigLoader(object):
"""Handles loading and parsing of mozconfig files."""
RE_MAKE_VARIABLE = re.compile('''
RE_MAKE_VARIABLE = re.compile(r'''
^\s* # Leading whitespace
(?P<var>[a-zA-Z_0-9]+) # Variable name
\s* [?:]?= \s* # Assignment operator surrounded by optional
+17 -17
View File
@@ -19,8 +19,8 @@ unary :
'!'? value ;
value :
[0-9]+ # integer
| 'defined(' \w+ ')'
| \w+ # string identifier or value;
| 'defined(' \\w+ ')'
| \\w+ # string identifier or value;
"""
import sys
@@ -128,7 +128,7 @@ class Expression:
Production: '!'? value
"""
# eat whitespace right away, too
not_ws = re.match('!\s*', self.content)
not_ws = re.match(r'!\s*', self.content)
if not not_ws:
return self.__get_value()
rv = Expression.__AST('not')
@@ -139,13 +139,13 @@ class Expression:
def __get_value(self):
"""
Production: ( [0-9]+ | 'defined(' \w+ ')' | \w+ )
Production: ( [0-9]+ | 'defined(' \\w+ ')' | \\w+ )
Note that the order is important, and the expression is kind-of
ambiguous as \w includes 0-9. One could make it unambiguous by
ambiguous as \\w includes 0-9. One could make it unambiguous by
removing 0-9 from the first char of a string literal.
"""
rv = None
m = re.match('defined\s*\(\s*(\w+)\s*\)', self.content)
m = re.match(r'defined\s*\(\s*(\w+)\s*\)', self.content)
if m:
word_len = m.end()
rv = Expression.__ASTLeaf('defined', m.group(1))
@@ -155,7 +155,7 @@ class Expression:
value = int(self.content[:word_len])
rv = Expression.__ASTLeaf('int', value)
else:
word_len = re.match('\w*', self.content).end()
word_len = re.match(r'\w*', self.content).end()
if word_len:
rv = Expression.__ASTLeaf('string', self.content[:word_len])
else:
@@ -165,7 +165,7 @@ class Expression:
return rv
def __ignore_whitespace(self):
ws_len = re.match('\s*', self.content).end()
ws_len = re.match(r'\s*', self.content).end()
self.__strip(ws_len)
return
@@ -312,7 +312,7 @@ class Preprocessor:
self.cmds[cmd] = (level, getattr(self, 'do_' + cmd))
self.out = sys.stdout
self.setMarker(marker)
self.varsubst = re.compile('@(?P<VAR>\w+)@', re.U)
self.varsubst = re.compile(r'@(?P<VAR>\w+)@', re.U)
self.includes = set()
self.silenceMissingDirectiveWarnings = False
if defines:
@@ -334,7 +334,7 @@ class Preprocessor:
"""
self.marker = aMarker
if aMarker:
self.instruction = re.compile('{0}(?P<cmd>[a-z]+)(?:\s(?P<args>.*))?$'
self.instruction = re.compile(r'{0}(?P<cmd>[a-z]+)(?:\s(?P<args>.*))?$'
.format(aMarker),
re.U)
self.comment = re.compile(aMarker, re.U)
@@ -498,7 +498,7 @@ class Preprocessor:
def getCommandLineParser(self, unescapeDefines = False):
escapedValue = re.compile('".*"$')
numberValue = re.compile('\d+$')
numberValue = re.compile(r'\d+$')
def handleD(option, opt, value, parser):
vals = value.split('=', 1)
if len(vals) == 1:
@@ -566,7 +566,7 @@ class Preprocessor:
# Variables
def do_define(self, args):
m = re.match('(?P<name>\w+)(?:\s(?P<value>.*))?', args, re.U)
m = re.match(r'(?P<name>\w+)(?:\s(?P<value>.*))?', args, re.U)
if not m:
raise Preprocessor.Error(self, 'SYNTAX_DEF', args)
val = ''
@@ -578,7 +578,7 @@ class Preprocessor:
pass
self.context[m.group('name')] = val
def do_undef(self, args):
m = re.match('(?P<name>\w+)$', args, re.U)
m = re.match(r'(?P<name>\w+)$', args, re.U)
if not m:
raise Preprocessor.Error(self, 'SYNTAX_DEF', args)
if args in self.context:
@@ -614,7 +614,7 @@ class Preprocessor:
if self.disableLevel and not replace:
self.disableLevel += 1
return
if re.match('\W', args, re.U):
if re.match(r'\W', args, re.U):
raise Preprocessor.Error(self, 'INVALID_VAR', args)
if args not in self.context:
self.disableLevel = 1
@@ -629,7 +629,7 @@ class Preprocessor:
if self.disableLevel and not replace:
self.disableLevel += 1
return
if re.match('\W', args, re.U):
if re.match(r'\W', args, re.U):
raise Preprocessor.Error(self, 'INVALID_VAR', args)
if args in self.context:
self.disableLevel = 1
@@ -673,7 +673,7 @@ class Preprocessor:
self.ifStates.pop()
# output processing
def do_expand(self, args):
lst = re.split('__(\w+)__', args, re.U)
lst = re.split(r'__(\w+)__', args, re.U)
do_replace = False
def vsubst(v):
if v in self.context:
@@ -762,7 +762,7 @@ class Preprocessor:
raise
except:
raise Preprocessor.Error(self, 'FILE_NOT_FOUND', str(args))
self.checkLineNumbers = bool(re.search('\.(js|jsm|java)(?:\.in)?$', args.name))
self.checkLineNumbers = bool(re.search(r'\.(js|jsm|java)(?:\.in)?$', args.name))
oldFile = self.context['FILE']
oldLine = self.context['LINE']
oldDir = self.context['DIRECTORY']
+1 -1
View File
@@ -33,7 +33,7 @@ UNQUOTED_TOKENS_RE = _tokens2re(
DOUBLY_QUOTED_TOKENS_RE = _tokens2re(
quote='"',
backslashedquote=r'\\"',
special='\$',
special=r'\$',
backslashed=r'\\[^\\"]',
)
+1 -1
View File
@@ -1147,7 +1147,7 @@ def pair(iterable):
return itertools.zip_longest(i, i)
VARIABLES_RE = re.compile('\$\((\w+)\)')
VARIABLES_RE = re.compile(r'\$\((\w+)\)')
def expand_variables(s, variables):
+1 -1
View File
@@ -100,7 +100,7 @@ class Component(object):
component = splits[0].strip()
if not component:
raise ValueError('No component found')
if not re.match('[a-zA-Z0-9_\-]+$', component):
if not re.match(r'[a-zA-Z0-9_\-]+$', component):
raise ValueError('Bad component name ' + component)
options = Component._split_options(splits[1]) if len(splits) > 1 else {}
return component, options
@@ -49,7 +49,7 @@ class Repository(object):
if self._version:
return self._version
info = self._run('--version').strip()
match = re.search('version ([^\+\)]+)', info)
match = re.search(r'version ([^\+\)]+)', info)
if not match:
raise Exception('Unable to identify tool version.')
@@ -195,7 +195,7 @@ class ExpressionParser(object):
LITERAL ::= BOOL | INT | IDENT | STRING
BOOL ::= 'true' | 'false'
INT ::= [0-9]+
IDENT ::= [a-zA-Z_]\w*
IDENT ::= [a-zA-Z_]\\w*
STRING ::= '"' [^\"] '"' | ''' [^\'] '''
At its core, expressions consist of booleans, integers, identifiers and.
+1 -1
View File
@@ -154,7 +154,7 @@ elif processor.upper() == "AMD64":
processor = "x86_64"
elif processor == "Power Macintosh":
processor = "ppc"
bits = re.search('(\d+)bit', bits).group(1)
bits = re.search(r'(\d+)bit', bits).group(1)
info.update({'processor': processor,
'bits': int(bits),
})
@@ -72,11 +72,11 @@ def _parse_ifconfig():
# Attempt to determine the default interface in use.
default_iface = _proc_matches(['route', '-n', 'get', 'default'],
'interface: (\w+)')
r'interface: (\w+)')
if default_iface:
addr_list = _proc_matches(['ifconfig', default_iface[0]],
'inet (\d+.\d+.\d+.\d+)')
r'inet (\d+.\d+.\d+.\d+)')
if addr_list:
logger.debug('Default interface: [%s] %s' % (default_iface[0],
addr_list[0]))
@@ -86,7 +86,7 @@ def _parse_ifconfig():
# Iterate over plausible interfaces if we didn't find a suitable default.
for iface in ['en%s' % i for i in range(10)]:
addr_list = _proc_matches(['ifconfig', iface],
'inet (\d+.\d+.\d+.\d+)')
r'inet (\d+.\d+.\d+.\d+)')
if addr_list:
logger.debug('Interface: [%s] %s' % (iface, addr_list[0]))
if not addr_list[0].startswith('127.'):
@@ -95,7 +95,7 @@ def _parse_ifconfig():
# Just return any that isn't localhost. If we can't find one, we have
# failed.
addrs = _proc_matches(['ifconfig'],
'inet (\d+.\d+.\d+.\d+)')
r'inet (\d+.\d+.\d+.\d+)')
try:
return [addr for addr in addrs if not addr.startswith('127.')][0]
except IndexError:
+3 -3
View File
@@ -141,9 +141,9 @@ class MozharnessRunner(MozbuildObject):
def _installer_url(self):
package_re = {
"linux": re.compile("^firefox-\d+\..+\.tar\.bz2$"),
"win": re.compile("^firefox-\d+\..+\.installer\.exe$"),
"mac": re.compile("^firefox-\d+\..+\.mac(?:64)?\.dmg$"),
"linux": re.compile(r"^firefox-\d+\..+\.tar\.bz2$"),
"win": re.compile(r"^firefox-\d+\..+\.installer\.exe$"),
"mac": re.compile(r"^firefox-\d+\..+\.mac(?:64)?\.dmg$"),
}[mozinfo.info['os']]
dist_path = os.path.join(self.topobjdir, "dist")
filenames = [item for item in os.listdir(dist_path) if
+3 -3
View File
@@ -31,7 +31,7 @@ def dependentlibs_dumpbin(lib):
for line in proc.stdout:
line = line.decode(getpreferredencoding(False))
# Each line containing an imported library name starts with 4 spaces
match = re.match(' (\S+)', line)
match = re.match(r' (\S+)', line)
if match:
deps.append(match.group(1))
elif len(deps):
@@ -47,7 +47,7 @@ def dependentlibs_mingw_objdump(lib):
deps = []
for line in proc.stdout:
line = line.decode(getpreferredencoding(False))
match = re.match('\tDLL Name: (\S+)', line)
match = re.match(r'\tDLL Name: (\S+)', line)
if match:
deps.append(match.group(1))
proc.wait()
@@ -88,7 +88,7 @@ def dependentlibs_readelf(lib):
# 0x00000001 (NEEDED) Shared library: [libname]
# or with BSD readelf:
# 0x00000001 NEEDED Shared library: [libname]
match = re.search('\[(.*)\]', tmp[3])
match = re.search(r'\[(.*)\]', tmp[3])
if match:
deps.append(match.group(1))
proc.wait()