Bug 1751990 - Removed usages of six underneath toolkit directory r=firefox-build-system-reviewers,glandium

Depends on D152463

Differential Revision: https://phabricator.services.mozilla.com/D137058
This commit is contained in:
Sean Pedigo 2022-08-17 20:53:47 +00:00
Родитель 94699183f2
Коммит 676a85b30d
6 изменённых файлов: 8 добавлений и 18 удалений

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

@ -7,7 +7,6 @@ import json
import pytoml import pytoml
import re import re
import sys import sys
import voluptuous import voluptuous
import voluptuous.humanize import voluptuous.humanize
from voluptuous import Schema, Optional, Any, All, Required, Length, Range, Msg, Match from voluptuous import Schema, Optional, Any, All, Required, Length, Range, Msg, Match

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

@ -6,11 +6,8 @@
from __future__ import unicode_literals, print_function from __future__ import unicode_literals, print_function
import six
def main(output, locale=None): def main(output, locale=None):
assert locale is not None assert locale is not None
# update.locale is a trivial file but let's be unicode aware anyway. # update.locale is a trivial file but let's be unicode aware anyway.
locale = six.ensure_text(locale)
print(locale, file=output) print(locale, file=output)

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

@ -6,16 +6,13 @@ from __future__ import absolute_import, unicode_literals, print_function
import sys import sys
import hashlib import hashlib
import re
import os
import functools import functools
from mozbuild.preprocessor import Preprocessor from mozbuild.preprocessor import Preprocessor
from mozbuild.util import DefinesAction from mozbuild.util import DefinesAction
from mozpack.packager.unpack import UnpackFinder from mozpack.packager.unpack import UnpackFinder
from mozpack.files import DeflatedFile from mozpack.files import DeflatedFile
from collections import OrderedDict from collections import OrderedDict
import six from io import StringIO
from six import StringIO
import argparse import argparse
import buildconfig import buildconfig
@ -58,8 +55,8 @@ def find_dupes(source, allowed_dupes, bail=True):
checksum = hashlib.sha1() checksum = hashlib.sha1()
content_size = 0 content_size = 0
for buf in iter(functools.partial(f.open().read, chunk_size), b""): for buf in iter(functools.partial(f.open().read, chunk_size), b""):
checksum.update(six.ensure_binary(buf)) checksum.update(buf)
content_size += len(six.ensure_binary(buf)) content_size += len(buf)
m = checksum.digest() m = checksum.digest()
if m not in checksums: if m not in checksums:
if isinstance(f, DeflatedFile): if isinstance(f, DeflatedFile):
@ -73,7 +70,7 @@ def find_dupes(source, allowed_dupes, bail=True):
num_dupes = 0 num_dupes = 0
unexpected_dupes = [] unexpected_dupes = []
for m, (size, compressed, paths) in sorted( for m, (size, compressed, paths) in sorted(
six.iteritems(checksums), key=lambda x: x[1][1] checksums.items(), key=lambda x: x[1][1]
): ):
if len(paths) > 1: if len(paths) > 1:
_compressed = " (%d compressed)" % compressed if compressed != size else "" _compressed = " (%d compressed)" % compressed if compressed != size else ""

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

@ -33,8 +33,7 @@ from collections import OrderedDict
from createprecomplete import generate_precomplete from createprecomplete import generate_precomplete
import os import os
import plistlib import plistlib
import six from io import StringIO
from six import StringIO
import subprocess import subprocess
@ -58,7 +57,7 @@ class RemovedFiles(GeneratedFile):
def __init__(self, copier): def __init__(self, copier):
self.copier = copier self.copier = copier
GeneratedFile.__init__(self, b"") GeneratedFile.__init__(self, "")
def handle_line(self, f): def handle_line(self, f):
f = f.strip() f = f.strip()
@ -66,7 +65,7 @@ class RemovedFiles(GeneratedFile):
return return
if self.copier.contains(f): if self.copier.contains(f):
errors.error("Removal of packaged file(s): %s" % f) errors.error("Removal of packaged file(s): %s" % f)
self.content += six.ensure_binary(f) + b"\n" self.content = f + "\n"
def split_define(define): def split_define(define):

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

@ -4,7 +4,6 @@
import argparse import argparse
import os import os
import six
import buildconfig import buildconfig
from mozpack.packager.formats import ( from mozpack.packager.formats import (
FlatFormatter, FlatFormatter,
@ -67,7 +66,7 @@ def main():
packager.close() packager.close()
# Transplant jar preloading information. # Transplant jar preloading information.
for path, log in six.iteritems(app1_finder.jarlogs): for path, log in app1_finder.jarlogs.items():
assert isinstance(copier[path], Jarrer) assert isinstance(copier[path], Jarrer)
copier[path].preload(log) copier[path].preload(log)

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

@ -14,7 +14,6 @@
from codecs import BOM_UTF16_LE from codecs import BOM_UTF16_LE
import io import io
from os.path import join, isfile from os.path import join, isfile
import six
import sys import sys
from optparse import OptionParser from optparse import OptionParser