Bug 1674162 - Remove reference to deleted function `plistlib.readPlist()` r=bc

Differential Revision: https://phabricator.services.mozilla.com/D95224
This commit is contained in:
Ricky Stewart 2020-11-06 14:30:18 +00:00
Родитель 3a5e389ce2
Коммит fe69c2f511
1 изменённых файлов: 10 добавлений и 5 удалений

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

@ -6,6 +6,7 @@ from __future__ import absolute_import, print_function
from optparse import OptionParser
import os
import plistlib
import shutil
import subprocess
import sys
@ -16,7 +17,7 @@ import zipfile
import requests
from six import reraise
from six import PY3, reraise
import mozfile
import mozinfo
@ -28,9 +29,6 @@ try:
except ImportError:
has_pefile = False
if mozinfo.isMac:
from plistlib import readPlist
TIMEOUT_UNINSTALL = 60
@ -58,6 +56,13 @@ class UninstallError(Exception):
"""Thrown when uninstallation fails. Includes traceback if available."""
def _readPlist(path):
if PY3:
with open(path, "rb") as fp:
return plistlib.load(fp)
return plistlib.readPlist(path)
def get_binary(path, app_name):
"""Find the binary in the specified path, and return its path. If binary is
not found throw an InvalidBinary exception.
@ -74,7 +79,7 @@ def get_binary(path, app_name):
raise InvalidBinary("%s/Contents/Info.plist not found" % path)
binary = os.path.join(
path, "Contents/MacOS/", readPlist(plist)["CFBundleExecutable"]
path, "Contents/MacOS/", _readPlist(plist)["CFBundleExecutable"]
)
else: