Bug 1962959 - Removed usage of six in python/mozbuild/mozpack/chrome and python/mozbuild/mozpack/packager directories. r=firefox-build-system-reviewers,ahochheiden
Patch assumes SimplePackager.add's parameter 'file' opens in binary mode by default. Add isinstance check in case this breaks anything. Differential Revision: https://phabricator.services.mozilla.com/D246886
This commit is contained in:
committed by
ahochheiden@mozilla.com
parent
68cc6bb059
commit
458e7691db
@@ -4,9 +4,7 @@
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
import six
|
||||
from six.moves.urllib.parse import urlparse
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import mozpack.path as mozpath
|
||||
from mozpack.chrome.flags import Flags
|
||||
@@ -380,7 +378,8 @@ def parse_manifest(root, path, fileobj=None):
|
||||
fileobj = open(path)
|
||||
linenum = 0
|
||||
for line in fileobj:
|
||||
line = six.ensure_text(line)
|
||||
if isinstance(line, bytes):
|
||||
line = line.decode()
|
||||
linenum += 1
|
||||
with errors.context(path, linenum):
|
||||
e = parse_manifest_line(base, line)
|
||||
|
||||
@@ -8,8 +8,6 @@ import os
|
||||
import re
|
||||
from collections import deque
|
||||
|
||||
import six
|
||||
|
||||
import mozpack.path as mozpath
|
||||
from mozbuild.preprocessor import Preprocessor
|
||||
from mozpack.chrome.manifest import (
|
||||
@@ -279,12 +277,12 @@ class SimplePackager:
|
||||
self._file_queue.append(self.formatter.add, path, file)
|
||||
if mozpath.basename(path) == "install.rdf":
|
||||
addon = True
|
||||
install_rdf = six.ensure_text(file.open().read())
|
||||
install_rdf = file.open().read().decode()
|
||||
if self.UNPACK_ADDON_RE.search(install_rdf):
|
||||
addon = "unpacked"
|
||||
self._add_addon(mozpath.dirname(path), addon)
|
||||
elif mozpath.basename(path) == "manifest.json":
|
||||
manifest = six.ensure_text(file.open().read())
|
||||
manifest = file.open().read()
|
||||
try:
|
||||
parsed = json.loads(manifest)
|
||||
except ValueError:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# 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/.
|
||||
|
||||
from six.moves.urllib.parse import urlparse
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import mozpack.path as mozpath
|
||||
from mozpack.chrome.manifest import (
|
||||
|
||||
@@ -10,7 +10,6 @@ directory.
|
||||
import json
|
||||
import os
|
||||
|
||||
import six
|
||||
from createprecomplete import generate_precomplete
|
||||
|
||||
import mozpack.path as mozpath
|
||||
@@ -92,7 +91,7 @@ class L10NRepackFormatterMixin:
|
||||
root, ext = mozpath.splitext(mozpath.basename(path))
|
||||
self._dictionaries[root] = path
|
||||
elif path.endswith("/built_in_addons.json"):
|
||||
data = json.loads(six.ensure_text(file.open().read()))
|
||||
data = json.loads(file.open().read())
|
||||
data["dictionaries"] = self._dictionaries
|
||||
# The GeneratedFile content is only really generated after
|
||||
# all calls to formatter.add.
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import codecs
|
||||
|
||||
from six.moves.urllib.parse import urlparse
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import mozpack.path as mozpath
|
||||
from mozpack.chrome.manifest import (
|
||||
|
||||
Reference in New Issue
Block a user