Bug 1715287 - [lint] Fix pyupgrade lint errors from new configuration r=linter-reviewers,webdriver-reviewers,taskgraph-reviewers,ahal,whimboo

Differential Revision: https://phabricator.services.mozilla.com/D245269
This commit is contained in:
Alex Hochheiden
2025-04-13 17:48:23 +00:00
parent fe3a7b54ed
commit c1e140fe43
206 changed files with 423 additions and 611 deletions

View File

@@ -240,7 +240,7 @@ class WaitForWinEvent:
ctypes.oledll.ole32.CoWaitForMultipleHandles(
COWAIT_DEFAULT, TIMEOUT, 1, handles, ctypes.byref(index)
)
except WindowsError as e:
except OSError as e:
if e.winerror == RPC_S_CALLPENDING:
raise TimeoutError("Timeout before desired event received")
raise
@@ -382,7 +382,7 @@ class WaitForUiaEvent(comtypes.COMObject):
ctypes.oledll.ole32.CoWaitForMultipleHandles(
COWAIT_DEFAULT, TIMEOUT, 1, handles, ctypes.byref(index)
)
except WindowsError as e:
except OSError as e:
if e.winerror == RPC_S_CALLPENDING:
raise TimeoutError("Timeout before desired event received")
raise

View File

@@ -132,7 +132,7 @@ def print_cpp_file(fd, conf, incdirs):
includes = []
for e in conf.simple_events:
if e not in includes:
includes.append(("nsIAccessible%s" % e))
includes.append("nsIAccessible%s" % e)
types = []
for e in conf.simple_events:

View File

@@ -3,7 +3,6 @@
# 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/.
import io
import re
import sys
from optparse import OptionParser
@@ -29,7 +28,7 @@ if not options.version:
# considered "newer" than previously-built newer versions (e.g. a trunk nightly)
define, MOZ_BUILDID, buildid = (
io.open(options.buildid, "r", encoding="utf-8").read().split()
open(options.buildid, "r", encoding="utf-8").read().split()
)
# extract only the major version (i.e. "14" from "14.0b1")

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

View File

@@ -605,7 +605,7 @@ def write_mozbuild(
):
conditions = set()
for args in all_args:
cond = tuple(((k, args.get(k) or "") for k in attrs))
cond = tuple((k, args.get(k) or "") for k in attrs)
conditions.add(cond)
for cond in sorted(conditions):
@@ -649,7 +649,7 @@ def write_mozbuild(
):
conditions = set()
for args in dirs_by_config.keys():
cond = tuple(((k, dict(args).get(k) or "") for k in attrs))
cond = tuple((k, dict(args).get(k) or "") for k in attrs)
conditions.add(cond)
for cond in sorted(conditions):

View File

@@ -69,7 +69,7 @@ def CopyFilesLocally(path, files, verbose=False, base_path=None):
for file in files:
file = os.path.abspath(file)
if not os.path.isfile(file):
raise IOError("File not found: %s" % file)
raise OSError("File not found: %s" % file)
# first ensure that path exists remotely
target_path = GetBaseRelativePath(path, file, base_path)
if not os.path.exists(target_path):
@@ -101,6 +101,6 @@ if __name__ == "__main__":
try:
CopyFilesLocally(path, args, base_path=options.base_path, verbose=True)
except IOError as strerror:
except OSError as strerror:
print(strerror)
sys.exit(1)

View File

@@ -80,7 +80,7 @@ def preprocess(path, defines):
pp.context.update(defines)
pp.out = io.StringIO()
pp.do_filter("substitution")
pp.do_include(io.open(path, "r", encoding="latin1"))
pp.do_include(open(path, "r", encoding="latin1"))
pp.out.seek(0)
return pp.out
@@ -305,7 +305,7 @@ def generate_module_rc(binary="", rcinclude=None):
manifest_path = manifest_path.replace("\\", "\\\\")
data += '\n{} RT_MANIFEST "{}"\n'.format(manifest_id, manifest_path)
with io.open("{}.rc".format(binary or "module"), "w", encoding="latin1") as fh:
with open("{}.rc".format(binary or "module"), "w", encoding="latin1") as fh:
fh.write(data)

View File

@@ -6,7 +6,6 @@
# longer present in a complete update. The current working directory is used for
# the location to enumerate and to create the precomplete file.
import io
import os
@@ -61,7 +60,7 @@ def generate_precomplete(root_path):
precomplete_file_path = os.path.join(root_path, rel_path_precomplete)
# Open the file so it exists before building the list of files and open it
# in binary mode to prevent OS specific line endings.
precomplete_file = io.open(precomplete_file_path, mode="wt", newline="\n")
precomplete_file = open(precomplete_file_path, mode="wt", newline="\n")
rel_file_path_list, rel_dir_path_list = get_build_entries(root_path)
for rel_file_path in rel_file_path_list:
precomplete_file.write('remove "' + rel_file_path + '"\n')

View File

@@ -192,7 +192,7 @@ class _MockBaseOpen(object):
elif absname in self.files:
content = self.files[absname]
if content is None:
raise IOError(2, "No such file or directory")
raise OSError(2, "No such file or directory")
file = self._mocked_file(absname, mode, content)
elif "a" in mode:
read_mode = "rb" if "b" in mode else "r"

View File

@@ -51,14 +51,14 @@ class TestNsinstall(unittest.TestCase):
"Test nsinstall -D <dir>"
testdir = os.path.join(self.tmpdir, "test")
self.assertEqual(nsinstall(["-D", testdir]), 0)
self.assert_(os.path.isdir(testdir))
self.assertTrue(os.path.isdir(testdir))
def test_nsinstall_basic(self):
"Test nsinstall <file> <dir>"
testfile = self.touch("testfile")
testdir = self.mkdirs("testdir")
self.assertEqual(nsinstall([testfile, testdir]), 0)
self.assert_(os.path.isfile(os.path.join(testdir, "testfile")))
self.assertTrue(os.path.isfile(os.path.join(testdir, "testfile")))
def test_nsinstall_basic_recursive(self):
"Test nsinstall <dir> <dest dir>"
@@ -75,12 +75,12 @@ class TestNsinstall(unittest.TestCase):
self.assertEqual(nsinstall([sourcedir, destdir, "-X", Xfile, "-X", Xdir]), 0)
testdir = os.path.join(destdir, "sourcedir")
self.assert_(os.path.isdir(testdir))
self.assert_(os.path.isfile(os.path.join(testdir, "testfile")))
self.assert_(not os.path.exists(os.path.join(testdir, "Xfile")))
self.assert_(os.path.isdir(os.path.join(testdir, "copieddir")))
self.assert_(os.path.isfile(os.path.join(testdir, "copieddir", "testfile2")))
self.assert_(not os.path.exists(os.path.join(testdir, "Xdir")))
self.assertTrue(os.path.isdir(testdir))
self.assertTrue(os.path.isfile(os.path.join(testdir, "testfile")))
self.assertTrue(not os.path.exists(os.path.join(testdir, "Xfile")))
self.assertTrue(os.path.isdir(os.path.join(testdir, "copieddir")))
self.assertTrue(os.path.isfile(os.path.join(testdir, "copieddir", "testfile2")))
self.assertTrue(not os.path.exists(os.path.join(testdir, "Xdir")))
def test_nsinstall_multiple(self):
"Test nsinstall <three files> <dest dir>"
@@ -92,14 +92,14 @@ class TestNsinstall(unittest.TestCase):
testdir = self.mkdirs("testdir")
self.assertEqual(nsinstall(testfiles + [testdir]), 0)
for f in testfiles:
self.assert_(os.path.isfile(os.path.join(testdir, os.path.basename(f))))
self.assertTrue(os.path.isfile(os.path.join(testdir, os.path.basename(f))))
def test_nsinstall_dir_exists(self):
"Test nsinstall <dir> <dest dir>, where <dest dir>/<dir> already exists"
srcdir = self.mkdirs("test")
destdir = self.mkdirs("testdir/test")
self.assertEqual(nsinstall([srcdir, os.path.dirname(destdir)]), 0)
self.assert_(os.path.isdir(destdir))
self.assertTrue(os.path.isdir(destdir))
def test_nsinstall_t(self):
"Test that nsinstall -t works (preserve timestamp)"
@@ -110,7 +110,7 @@ class TestNsinstall(unittest.TestCase):
os.utime(testfile, (t, t))
self.assertEqual(nsinstall(["-t", testfile, testdir]), 0)
destfile = os.path.join(testdir, "testfile")
self.assert_(os.path.isfile(destfile))
self.assertTrue(os.path.isfile(destfile))
self.assertEqual(os.stat(testfile).st_mtime, os.stat(destfile).st_mtime)
@unittest.skipIf(sys.platform == "win32", "Windows doesn't have real file modes")
@@ -124,7 +124,7 @@ class TestNsinstall(unittest.TestCase):
nsinstall(["-m", "{0:04o}".format(mode), testfile, testdir]), 0
)
destfile = os.path.join(testdir, "testfile")
self.assert_(os.path.isfile(destfile))
self.assertTrue(os.path.isfile(destfile))
self.assertEqual(os.stat(testfile).st_mode, os.stat(destfile).st_mode)
def test_nsinstall_d(self):
@@ -134,7 +134,7 @@ class TestNsinstall(unittest.TestCase):
testdir = self.mkdirs("testdir")
destdir = os.path.join(testdir, "subdir")
self.assertEqual(nsinstall(["-d", testfile, destdir]), 0)
self.assert_(os.path.isdir(os.path.join(destdir, "testfile")))
self.assertTrue(os.path.isdir(os.path.join(destdir, "testfile")))
@unittest.skipIf(not RUN_NON_ASCII_TESTS, "Skipping non ascii tests")
def test_nsinstall_non_ascii(self):
@@ -147,7 +147,7 @@ class TestNsinstall(unittest.TestCase):
)
destfile = os.path.join(testdir, filename)
self.assert_(os.path.isfile(destfile))
self.assertTrue(os.path.isfile(destfile))
# Executing nsinstall.py with python 2 is not supported.
@unittest.skipIf(
@@ -163,7 +163,7 @@ class TestNsinstall(unittest.TestCase):
self.assertEqual(rv, 0)
destfile = os.path.join(testdir, filename)
self.assert_(os.path.isfile(destfile))
self.assertTrue(os.path.isfile(destfile))
# TODO: implement -R, -l, -L and test them!

View File

@@ -137,7 +137,7 @@ class TestExtensiveStored(unittest.TestCase):
def _verifyZip(self):
zf = zipfile.ZipFile(self.f)
badEntry = zf.testzip()
self.failIf(badEntry, badEntry)
self.assertFalse(badEntry, badEntry)
zlist = zf.namelist()
zlist.sort()
vlist = self.ref.keys()

View File

@@ -3,7 +3,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import codecs
import io
import itertools
import logging
import os
@@ -276,7 +275,7 @@ def config_status(config, execute=True):
# Write out a file so the build backend knows to re-run configure when
# relevant Python changes.
with io.open("config_status_deps.in", "w", encoding="utf-8", newline="\n") as fh:
with open("config_status_deps.in", "w", encoding="utf-8", newline="\n") as fh:
for f in sorted(
itertools.chain(
config["CONFIG_STATUS_DEPS"],

View File

@@ -2,7 +2,6 @@
# 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/.
import io
import itertools
import os
from collections import defaultdict
@@ -94,7 +93,7 @@ class Configuration(DescriptorProvider):
# Read the configuration file.
glbl = {}
exec(io.open(filename, encoding="utf-8").read(), glbl)
exec(open(filename, encoding="utf-8").read(), glbl)
config = glbl["DOMInterfaces"]
self.attributeTemplates = dict()

View File

@@ -7,7 +7,6 @@
import errno
import hashlib
import io
import json
import logging
import os
@@ -284,7 +283,7 @@ class WebIDLCodegenManager(LoggingMixin):
self._state = WebIDLCodegenManagerState()
if os.path.exists(state_path):
with io.open(state_path, "r") as fh:
with open(state_path, "r") as fh:
try:
self._state = WebIDLCodegenManagerState(fh=fh)
except Exception as e:
@@ -443,7 +442,7 @@ class WebIDLCodegenManager(LoggingMixin):
parser = WebIDL.Parser(self._cache_dir, lexer=None)
for path in sorted(self._input_paths):
with io.open(path, "r", encoding="utf-8") as fh:
with open(path, "r", encoding="utf-8") as fh:
data = fh.read()
hashes[path] = hashlib.sha1(data.encode()).hexdigest()
parser.parse(data, path)
@@ -662,7 +661,7 @@ class WebIDLCodegenManager(LoggingMixin):
for f in current_files:
# This will fail if the file doesn't exist. If a current global
# dependency doesn't exist, something else is wrong.
with io.open(f, "rb") as fh:
with open(f, "rb") as fh:
current_hashes[f] = hashlib.sha1(fh.read()).hexdigest()
# The set of files has changed.
@@ -677,7 +676,7 @@ class WebIDLCodegenManager(LoggingMixin):
return False, current_hashes
def _save_state(self):
with io.open(self._state_path, "w", newline="\n") as fh:
with open(self._state_path, "w", newline="\n") as fh:
self._state.dump(fh)
def _maybe_write_codegen(self, obj, declare_path, define_path, result=None):
@@ -717,7 +716,7 @@ def create_build_system_manager(topsrcdir=None, topobjdir=None, dist_dir=None):
obj_dir = os.path.join(topobjdir, "dom", "bindings")
webidl_root = os.path.join(topsrcdir, "dom", "webidl")
with io.open(os.path.join(obj_dir, "file-lists.json"), "r") as fh:
with open(os.path.join(obj_dir, "file-lists.json"), "r") as fh:
files = json.load(fh)
inputs = (

View File

@@ -2,7 +2,6 @@
# 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/.
import io
import json
import os
import shutil
@@ -81,7 +80,7 @@ class TestWebIDLCodegenManager(unittest.TestCase):
p = args["state_path"]
with io.open(p, "w", newline="\n") as fh:
with open(p, "w", newline="\n") as fh:
json.dump(
{
"version": WebIDLCodegenManagerState.VERSION + 1,
@@ -127,7 +126,7 @@ class TestWebIDLCodegenManager(unittest.TestCase):
self.assertTrue(os.path.isfile(manager._state_path))
with io.open(manager._state_path, "r") as fh:
with open(manager._state_path, "r") as fh:
state = json.load(fh)
self.assertEqual(state["version"], 3)
self.assertIn("webidls", state)
@@ -193,7 +192,7 @@ class TestWebIDLCodegenManager(unittest.TestCase):
break
self.assertIsNotNone(child_path)
child_content = io.open(child_path, "r").read()
child_content = open(child_path, "r").read()
with MockedOpen({child_path: child_content + "\n/* */"}):
m2 = WebIDLCodegenManager(**args)
@@ -217,7 +216,7 @@ class TestWebIDLCodegenManager(unittest.TestCase):
child_path = p
self.assertIsNotNone(parent_path)
parent_content = io.open(parent_path, "r").read()
parent_content = open(parent_path, "r").read()
with MockedOpen({parent_path: parent_content + "\n/* */"}):
m2 = WebIDLCodegenManager(**args)
@@ -254,7 +253,7 @@ class TestWebIDLCodegenManager(unittest.TestCase):
result = m1.generate_build_files(processes=1)
l = len(result.inputs)
with io.open(fake_path, "wt", newline="\n") as fh:
with open(fake_path, "wt", newline="\n") as fh:
fh.write("# Modified content")
m2 = WebIDLCodegenManager(**args)

View File

@@ -2,7 +2,6 @@
# 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 __future__ import print_function
import argparse
import glob

View File

@@ -282,14 +282,12 @@ def WebIDLTest(parser, harness):
parser = parser.reset()
parser.parse(
(
"\n"
" interface TestPrefChromeOnlySCFuncConstructor {\n"
' [ChromeOnly, Pref="dom.webidl.test1", SecureContext, '
'Func="IsNotUAWidget"]\n'
" constructor();\n"
" };\n"
)
"\n"
" interface TestPrefChromeOnlySCFuncConstructor {\n"
' [ChromeOnly, Pref="dom.webidl.test1", SecureContext, '
'Func="IsNotUAWidget"]\n'
" constructor();\n"
" };\n"
)
results = parser.finish()
harness.check(len(results), 1, "Should be one production")

View File

@@ -16,7 +16,7 @@ def read_local_file(include):
try:
return file_path.read_bytes()
except IOError:
except OSError:
return b""

View File

@@ -184,11 +184,9 @@ def vendor_and_commit(
if len(resume_state) == 0:
update_resume_state("resume2", resume_state_filename)
error_help.set_help(
(
f"Running script '{script_dir}/vendor-libwebrtc.py' failed.\n"
f"Please manually confirm that all changes from git ({github_path})\n"
"are reflected in the output of 'hg diff'"
)
f"Running script '{script_dir}/vendor-libwebrtc.py' failed.\n"
f"Please manually confirm that all changes from git ({github_path})\n"
"are reflected in the output of 'hg diff'"
)
vendor_current_stack(github_branch, github_path, script_dir)
error_help.set_help(None)

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -2079,7 +2078,7 @@ def updateCLDRLangTags(args):
readFiles(cldr_data)
print("Writing Intl data...")
with io.open(out, mode="w", encoding="utf-8", newline="") as f:
with open(out, mode="w", encoding="utf-8", newline="") as f:
println = partial(print, file=f)
writeCLDRLanguageTagData(println, data, url)
@@ -2090,7 +2089,7 @@ def updateCLDRLangTags(args):
js_src_builtin_intl_dir,
"../../tests/non262/Intl/Locale/likely-subtags-generated.js",
)
with io.open(test_file, mode="w", encoding="utf-8", newline="") as f:
with open(test_file, mode="w", encoding="utf-8", newline="") as f:
println = partial(print, file=f)
println("// |reftest| skip-if(!this.hasOwnProperty('Intl'))")
@@ -2099,7 +2098,7 @@ def updateCLDRLangTags(args):
def flines(filepath, encoding="utf-8"):
"""Open filepath and iterate over its content."""
with io.open(filepath, mode="r", encoding=encoding) as f:
with open(filepath, mode="r", encoding=encoding) as f:
for line in f:
yield line
@@ -2666,7 +2665,7 @@ def readZoneTab(tzdataDir):
def availableNamedTimeZoneIdentifiers(tzdataDir, ignoreFactory):
js_src_builtin_intl_dir = os.path.dirname(os.path.abspath(__file__))
with io.open(
with open(
os.path.join(js_src_builtin_intl_dir, "TimeZoneMapping.yaml"),
mode="r",
encoding="utf-8",
@@ -2807,7 +2806,7 @@ def processTimeZones(tzdataDir, icuDir, icuTzDir, version, ignoreFactory, out):
print("<<< Maybe https://ssl.icu-project.org/trac/ticket/12044 was fixed? >>>")
print("Writing Intl tzdata file...")
with io.open(out, mode="w", encoding="utf-8", newline="") as f:
with open(out, mode="w", encoding="utf-8", newline="") as f:
println = partial(print, file=f)
println(generatedFileWarning)
@@ -2872,7 +2871,7 @@ def generateTzDataTestLinks(tzdataDir, version, ignoreFactory, testDir):
# Read zone and link infos.
(_, links) = availableNamedTimeZoneIdentifiers(tzdataDir, ignoreFactory)
with io.open(
with open(
os.path.join(testDir, fileName), mode="w", encoding="utf-8", newline=""
) as f:
println = partial(print, file=f)
@@ -2922,7 +2921,7 @@ if (typeof reportCompare === "function")
def generateTzDataTestVersion(tzdataDir, version, testDir):
fileName = "timeZone_version.js"
with io.open(
with open(
os.path.join(testDir, fileName), mode="w", encoding="utf-8", newline=""
) as f:
println = partial(print, file=f)
@@ -2955,7 +2954,7 @@ def generateTzDataTestCanonicalZones(tzdataDir, version, ignoreFactory, testDir)
# Read zone and link infos.
(zones, _) = availableNamedTimeZoneIdentifiers(tzdataDir, ignoreFactory)
with io.open(
with open(
os.path.join(testDir, fileName), mode="w", encoding="utf-8", newline=""
) as f:
println = partial(print, file=f)
@@ -2988,7 +2987,7 @@ def generateTzDataTestZones(tzdataDir, version, ignoreFactory, testDir):
# Read zone and link infos.
(zones, links) = availableNamedTimeZoneIdentifiers(tzdataDir, ignoreFactory)
with io.open(
with open(
os.path.join(testDir, fileName), mode="w", encoding="utf-8", newline=""
) as f:
println = partial(print, file=f)
@@ -3189,7 +3188,7 @@ def readCurrencyFile(tree):
def writeCurrencyFile(published, currencies, out):
with io.open(out, mode="w", encoding="utf-8", newline="") as f:
with open(out, mode="w", encoding="utf-8", newline="") as f:
println = partial(print, file=f)
println(generatedFileWarning)
@@ -3595,7 +3594,7 @@ def computeSupportedUnits(all_units, sanctioned_units):
def readICUDataFilterForUnits(data_filter_file):
with io.open(data_filter_file, mode="r", encoding="utf-8") as f:
with open(data_filter_file, mode="r", encoding="utf-8") as f:
data_filter = json.load(f)
# Find the rule set for the "unit_tree".
@@ -3630,7 +3629,7 @@ def writeSanctionedSimpleUnitIdentifiersFiles(all_units, sanctioned_units):
sanctioned_js_file = os.path.join(
js_src_builtin_intl_dir, "SanctionedSimpleUnitIdentifiersGenerated.js"
)
with io.open(sanctioned_js_file, mode="w", encoding="utf-8", newline="") as f:
with open(sanctioned_js_file, mode="w", encoding="utf-8", newline="") as f:
println = partial(print, file=f)
sanctioned_units_object = json.dumps(
@@ -3657,7 +3656,7 @@ def writeSanctionedSimpleUnitIdentifiersFiles(all_units, sanctioned_units):
)
sanctioned_h_file = os.path.join(intl_components_src_dir, "MeasureUnitGenerated.h")
with io.open(sanctioned_h_file, mode="w", encoding="utf-8", newline="") as f:
with open(sanctioned_h_file, mode="w", encoding="utf-8", newline="") as f:
println = partial(print, file=f)
println(generatedFileWarning)
@@ -3712,7 +3711,7 @@ def writeUnitTestFiles(all_units, sanctioned_units):
def write_test(file_name, test_content, indent=4):
file_path = os.path.join(test_dir, file_name)
with io.open(file_path, mode="w", encoding="utf-8", newline="") as f:
with open(file_path, mode="w", encoding="utf-8", newline="") as f:
println = partial(print, file=f)
println('// |reftest| skip-if(!this.hasOwnProperty("Intl"))')
@@ -3840,7 +3839,7 @@ def updateUnits(topsrcdir, args):
icu_path = os.path.join(topsrcdir, "intl", "icu")
icu_unit_path = os.path.join(icu_path, "source", "data", "unit")
with io.open(
with open(
os.path.join(js_src_builtin_intl_dir, "SanctionedSimpleUnitIdentifiers.yaml"),
mode="r",
encoding="utf-8",
@@ -3987,9 +3986,7 @@ def writeNumberingSystemFiles(numbering_systems):
numbering_systems_js_file = os.path.join(
js_src_builtin_intl_dir, "NumberingSystemsGenerated.h"
)
with io.open(
numbering_systems_js_file, mode="w", encoding="utf-8", newline=""
) as f:
with open(numbering_systems_js_file, mode="w", encoding="utf-8", newline="") as f:
println = partial(print, file=f)
println(generatedFileWarning)
@@ -4030,7 +4027,7 @@ def writeNumberingSystemFiles(numbering_systems):
intl_shell_js_file = os.path.join(test_dir, "shell.js")
with io.open(intl_shell_js_file, mode="w", encoding="utf-8", newline="") as f:
with open(intl_shell_js_file, mode="w", encoding="utf-8", newline="") as f:
println = partial(print, file=f)
println(generatedFileWarning)
@@ -4060,7 +4057,7 @@ def updateNumberingSystems(topsrcdir, args):
icu_path = os.path.join(topsrcdir, "intl", "icu")
icu_misc_path = os.path.join(icu_path, "source", "data", "misc")
with io.open(
with open(
os.path.join(js_src_builtin_intl_dir, "NumberingSystems.yaml"),
mode="r",
encoding="utf-8",

View File

@@ -13,13 +13,9 @@ import argparse
import os
import subprocess
import sys
from shlex import quote
from subprocess import Popen
try:
from shlex import quote
except ImportError:
from pipes import quote
def execfile(thefile, globals):
exec(compile(open(thefile).read(), filename=thefile, mode="exec"), globals)

View File

@@ -330,7 +330,7 @@ try:
print_footer(html)
except IOError as e:
except OSError as e:
print("Failed: %s" % str(e))
if args.verbose:

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
@@ -633,7 +631,7 @@ def view_hazards(command_context, project, haz_objdir, work_dir, port, serve_onl
if len(tops) > 0:
break # Found a file underneath a root.
else:
raise IOError("not found")
raise OSError("not found")
html = annotated_source(fullpath, request.query)
log("serve '{req}' -> 200 {path}")
@@ -642,7 +640,7 @@ def view_hazards(command_context, project, haz_objdir, work_dir, port, serve_onl
{"Content-type": "text/html", "Content-length": len(html)},
html,
)
except (IOError, ValueError):
except (OSError, ValueError):
log("serve '{req}' -> 404 {path}", logging.ERROR)
return (
404,

View File

@@ -123,7 +123,7 @@ class Summary(object):
with open(OPTIONS.worklist) as out:
for test in self.failures:
out.write(test.name + "\n")
except IOError as err:
except OSError as err:
sys.stderr.write(
"Error writing worklist file '%s': %s" % (OPTIONS.worklist, err)
)
@@ -134,7 +134,7 @@ class Summary(object):
with open(OPTIONS.write_failures, "w") as out:
for test in self.failures:
test.show(out)
except IOError as err:
except OSError as err:
sys.stderr.write(
"Error writing worklist file '%s': %s"
% (OPTIONS.write_failures, err)
@@ -407,7 +407,7 @@ def main(argv):
with open(OPTIONS.worklist) as f:
for line in f:
test_set.update(os.path.join(OPTIONS.testdir, line.strip("\n")))
except IOError:
except OSError:
# With worklist, a missing file means to start the process with
# the complete list of tests.
sys.stderr.write(
@@ -420,7 +420,7 @@ def main(argv):
with open(OPTIONS.read_tests) as f:
for line in f:
test_set.update(os.path.join(OPTIONS.testdir, line.strip("\n")))
except IOError as err:
except OSError as err:
sys.stderr.write(
"Error trying to read test file '%s': %s\n" % (OPTIONS.read_tests, err)
)

View File

@@ -420,7 +420,7 @@ def main(argv):
for line in f:
test_list.append(os.path.join(jittests.TEST_DIR, line.strip("\n")))
f.close()
except IOError:
except OSError:
if options.retest:
read_all = True
else:
@@ -507,7 +507,7 @@ def main(argv):
path = line.strip("\n")
ignore.add(path)
options.ignore_timeouts = ignore
except IOError:
except OSError:
sys.exit("Error reading file: " + options.ignore_timeouts)
else:
options.ignore_timeouts = set()

View File

@@ -489,7 +489,7 @@ def generate_cacheirops_header(c_out, yaml_path):
assert isinstance(transpile, bool)
# Unscored Ops default to UINT32_MAX
cost_estimate = op.get("cost_estimate", int(0xFFFFFFFF))
cost_estimate = op.get("cost_estimate", 0xFFFFFFFF)
assert isinstance(cost_estimate, int)
custom_writer = op.get("custom_writer", False)

View File

@@ -482,7 +482,7 @@ def parse_args():
options.show_output = True
try:
options.output_fp = open(options.output_file, "w")
except IOError as ex:
except OSError as ex:
raise SystemExit("Failed to open output file: " + str(ex))
# Hide the progress bar if it will get in the way of other output.

View File

@@ -644,7 +644,7 @@ def print_test_summary(num_tests, failures, complete, slow_tests, doing, options
out.write("Exit code: " + str(res.rc) + "\n")
written.add(res.test.path)
out.close()
except IOError:
except OSError:
sys.stderr.write(
"Exception thrown trying to write failure"
" file '{}'\n".format(options.write_failures)

View File

@@ -2,7 +2,6 @@
#
# This includes classes for representing and parsing JS manifests.
import io
import os
import posixpath
import re
@@ -78,7 +77,7 @@ class XULInfo:
# Read the values.
val_re = re.compile(r"(TARGET_XPCOM_ABI|OS_TARGET|MOZ_DEBUG)\s*=\s*(.*)")
kw = {"isdebug": False}
for line in io.open(path, encoding="utf-8"):
for line in open(path, encoding="utf-8"):
m = val_re.match(line)
if m:
key, val = m.groups()
@@ -372,7 +371,7 @@ def _emit_manifest_at(location, relative, test_gen, depth):
"url-prefix {}jsreftest.html?test={}/".format("../" * depth, relative)
] + manifest
fp = io.open(filename, "w", encoding="utf-8", newline="\n")
fp = open(filename, "w", encoding="utf-8", newline="\n")
try:
fp.write("\n".join(manifest) + "\n")
finally:
@@ -505,7 +504,7 @@ def _parse_external_manifest(filename, relpath):
entries = []
with io.open(filename, "r", encoding="utf-8") as fp:
with open(filename, "r", encoding="utf-8") as fp:
manifest_re = re.compile(
r"^\s*(?P<terms>.*)\s+(?P<type>include|script)\s+(?P<path>\S+)$"
)

View File

@@ -120,7 +120,7 @@ def _do_watch(qWatch, timeout):
# Timed out, force-kill the test.
try:
proc.terminate()
except WindowsError as ex:
except OSError as ex:
# If the process finishes after we time out but before we
# terminate, the terminate call will fail. We can safely
# ignore this.

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this

View File

@@ -1,12 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
import contextlib
import io
import os
import shutil
import sys
@@ -204,7 +202,7 @@ def writeTestFile(test262OutDir, testFileName, source):
Writes the test source to |test262OutDir|.
"""
with io.open(os.path.join(test262OutDir, testFileName), "wb") as output:
with open(os.path.join(test262OutDir, testFileName), "wb") as output:
output.write(source)
@@ -239,7 +237,7 @@ def writeShellAndBrowserFiles(
yield include
def readIncludeFile(filePath):
with io.open(filePath, "rb") as includeFile:
with open(filePath, "rb") as includeFile:
return b"// file: %s\n%s" % (
os.path.basename(filePath).encode("utf-8"),
includeFile.read(),
@@ -261,15 +259,13 @@ def writeShellAndBrowserFiles(
)
# Write the concatenated include sources to shell.js.
with io.open(os.path.join(test262OutDir, relPath, "shell.js"), "wb") as shellFile:
with open(os.path.join(test262OutDir, relPath, "shell.js"), "wb") as shellFile:
if includeSource:
shellFile.write(b"// GENERATED, DO NOT EDIT\n")
shellFile.write(includeSource)
# The browser.js file is always empty for test262 tests.
with io.open(
os.path.join(test262OutDir, relPath, "browser.js"), "wb"
) as browserFile:
with open(os.path.join(test262OutDir, relPath, "browser.js"), "wb") as browserFile:
browserFile.write(b"")
@@ -400,7 +396,7 @@ def convertTestFile(test262parser, testSource, testName, includeSet, strictTests
if shellOptions:
refTestSkipIf.append(("!xulRuntime.shell", "requires shell-options"))
refTestOptions.extend(
("shell-option({})".format(opt) for opt in sorted(shellOptions))
"shell-option({})".format(opt) for opt in sorted(shellOptions)
)
# Optional shell options. Some tests use feature detection for additional
@@ -413,7 +409,7 @@ def convertTestFile(test262parser, testSource, testName, includeSet, strictTests
if include in INCLUDE_FEATURE_DETECTED_OPTIONAL_SHELL_OPTIONS
)
refTestOptions.extend(
("shell-option({})".format(opt) for opt in sorted(optionalShellOptions))
"shell-option({})".format(opt) for opt in sorted(optionalShellOptions)
)
# Includes for every test file in a directory is collected in a single
@@ -579,7 +575,7 @@ def process_test262(test262Dir, test262OutDir, strictTests, externManifests):
isFixtureFile = fileName.endswith("_FIXTURE.js")
# Read the original test source and preprocess it for the jstests harness.
with io.open(filePath, "rb") as testFile:
with open(filePath, "rb") as testFile:
testSource = testFile.read()
if isFixtureFile:
@@ -765,9 +761,7 @@ def fetch_pr_files(inDir, outDir, prNumber, strictTests):
if not os.path.isdir(filePathDirs):
os.makedirs(filePathDirs)
with io.open(
os.path.join(inDir, *filename.split("/")), "wb"
) as output_file:
with open(os.path.join(inDir, *filename.split("/")), "wb") as output_file:
output_file.write(fileText.encode("utf8"))
hasNext = False
@@ -849,7 +843,7 @@ def general_update(inDir, outDir, strictTests):
shutil.copyfile(os.path.join(inDir, "LICENSE"), os.path.join(outDir, "LICENSE"))
# Create the git info file.
with io.open(os.path.join(outDir, "GIT-INFO"), "w", encoding="utf-8") as info:
with open(os.path.join(outDir, "GIT-INFO"), "w", encoding="utf-8") as info:
subprocess.check_call(["git", "-C", inDir, "log", "-1"], stdout=info)
# Copy the test files.
@@ -857,7 +851,7 @@ def general_update(inDir, outDir, strictTests):
process_test262(inDir, outDir, strictTests, externManifests)
# Create the external reftest manifest file.
with io.open(os.path.join(outDir, "jstests.list"), "wb") as manifestFile:
with open(os.path.join(outDir, "jstests.list"), "wb") as manifestFile:
manifestFile.write(b"# GENERATED, DO NOT EDIT\n\n")
for externManifest in sorted(externManifests, key=itemgetter("name")):
(terms, comments) = externManifest["reftest"]

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Based upon makeunicodedata.py
# (http://hg.python.org/cpython/file/c8192197d23d/Tools/unicode/makeunicodedata.py)
# written by Fredrik Lundh (fredrik@pythonware.com)
@@ -118,7 +117,7 @@ def read_unicode_data(unicode_data):
http://www.unicode.org/reports/tr44/
"""
reader = csv.reader(unicode_data, delimiter=str(";"))
reader = csv.reader(unicode_data, delimiter=";")
while True:
row = next(reader, None)
@@ -639,7 +638,7 @@ def process_special_casing(special_casing, table, index):
def make_non_bmp_file(version, non_bmp_lower_map, non_bmp_upper_map, codepoint_table):
file_name = "UnicodeNonBMP.h"
with io.open(file_name, mode="w", encoding="utf-8") as non_bmp_file:
with open(file_name, mode="w", encoding="utf-8") as non_bmp_file:
non_bmp_file.write(mpl_license)
non_bmp_file.write("\n")
non_bmp_file.write(warning_message)
@@ -982,7 +981,7 @@ def make_bmp_mapping_test(
return "\\u{:04X}".format(n)
file_name = "../tests/non262/String/string-upper-lower-mapping.js"
with io.open(file_name, mode="w", encoding="utf-8") as output:
with open(file_name, mode="w", encoding="utf-8") as output:
write = partial(print, file=output, sep="", end="")
println = partial(print, file=output, sep="", end="\n")
@@ -1036,7 +1035,7 @@ def make_non_bmp_mapping_test(
version, non_bmp_upper_map, non_bmp_lower_map, codepoint_table
):
file_name = "../tests/non262/String/string-code-point-upper-lower-mapping.js"
with io.open(file_name, mode="w", encoding="utf-8") as test_non_bmp_mapping:
with open(file_name, mode="w", encoding="utf-8") as test_non_bmp_mapping:
test_non_bmp_mapping.write(warning_message)
test_non_bmp_mapping.write(unicode_version_message.format(version))
test_non_bmp_mapping.write(public_domain)
@@ -1078,7 +1077,7 @@ def make_space_test(version, test_space_table, codepoint_table):
return " 0x{:04X} /* {} */".format(c, codepoint_table.name(c))
file_name = "../tests/non262/String/string-space-trim.js"
with io.open(file_name, mode="w", encoding="utf-8") as test_space:
with open(file_name, mode="w", encoding="utf-8") as test_space:
test_space.write(warning_message)
test_space.write(unicode_version_message.format(version))
test_space.write(public_domain)
@@ -1103,7 +1102,7 @@ def make_regexp_space_test(version, test_space_table, codepoint_table):
return " 0x{:04X} /* {} */".format(c, codepoint_table.name(c))
file_name = "../tests/non262/RegExp/character-class-escape-s.js"
with io.open(file_name, mode="w", encoding="utf-8") as test_space:
with open(file_name, mode="w", encoding="utf-8") as test_space:
test_space.write(warning_message)
test_space.write(unicode_version_message.format(version))
test_space.write(public_domain)
@@ -1140,7 +1139,7 @@ def make_icase_test(version, folding_tests, codepoint_table):
return "0x{:04X}".format(c)
file_name = "../tests/non262/RegExp/unicode-ignoreCase.js"
with io.open(file_name, mode="w", encoding="utf-8") as test_icase:
with open(file_name, mode="w", encoding="utf-8") as test_icase:
test_icase.write("// |reftest| skip-if(!this.hasOwnProperty('Intl'))\n\n")
test_icase.write(warning_message)
test_icase.write(unicode_version_message.format(version))
@@ -1317,7 +1316,7 @@ def make_unicode_file(
println("")
file_name = "Unicode.cpp"
with io.open(file_name, "w", encoding="utf-8") as data_file:
with open(file_name, "w", encoding="utf-8") as data_file:
write = partial(print, file=data_file, sep="", end="")
println = partial(print, file=data_file, sep="", end="\n")
@@ -1483,13 +1482,13 @@ def update_unicode(args):
pat_version = re.compile(r"# %s-(?P<version>\d+\.\d+\.\d+).txt" % fname)
return pat_version.match(f.readline()).group("version")
with io.open(
with open(
os.path.join(base_path, "UnicodeData.txt"), "r", encoding="utf-8"
) as unicode_data, io.open(
) as unicode_data, open(
os.path.join(base_path, "CaseFolding.txt"), "r", encoding="utf-8"
) as case_folding, io.open(
) as case_folding, open(
os.path.join(base_path, "DerivedCoreProperties.txt"), "r", encoding="utf-8"
) as derived_core_properties, io.open(
) as derived_core_properties, open(
os.path.join(base_path, "SpecialCasing.txt"), "r", encoding="utf-8"
) as special_casing:
unicode_version = version_from_file(

View File

@@ -3,7 +3,6 @@
# 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/.
import io
import os
import struct
import sys
@@ -72,7 +71,7 @@ if len(sys.argv) < 2 or not os.path.exists(sys.argv[1]):
usage()
for filename in sys.argv[1:]:
with io.open(filename, "rb") as f:
with open(filename, "rb") as f:
magic = f.read(len(MAGIC))
if magic != MAGIC:
raise Exception("Bad magic number")

View File

@@ -2,7 +2,6 @@
# 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/.
import io
import os
import re
@@ -143,7 +142,7 @@ class ReftestManifest(object):
if self.finder:
lines = self.finder.get(path).read().splitlines()
else:
with io.open(path, "r", encoding="utf-8") as fh:
with open(path, "r", encoding="utf-8") as fh:
lines = fh.read().splitlines()
urlprefix = ""

View File

@@ -96,17 +96,12 @@ summaryLines = [
]
if sys.version_info[0] == 3:
def reraise_(tp_, value_, tb_=None):
if value_ is None:
value_ = tp_()
if value_.__traceback__ is not tb_:
raise value_.with_traceback(tb_)
raise value_
else:
exec("def reraise_(tp_, value_, tb_=None):\n raise tp_, value_, tb_\n")
def reraise_(tp_, value_, tb_=None):
if value_ is None:
value_ = tp_()
if value_.__traceback__ is not tb_:
raise value_.with_traceback(tb_)
raise value_
def update_mozinfo():
@@ -964,7 +959,7 @@ class RefTest(object):
addons.install(options.reftestExtensionPath, temp=True)
marionette.delete_session()
except IOError as e:
except OSError as e:
# Any IOError as thrown by Marionette means that something is
# wrong with the process, like a crash or the socket is no
# longer open. We defer raising this specific error so that

View File

@@ -124,7 +124,7 @@ def load_results_file(filename):
print(f"Error parsing {filename} file: {e}")
finally:
f.close()
except IOError as e:
except OSError as e:
print(e)
return ret

View File

@@ -1,6 +1,5 @@
#!/usr/bin/python3
from __future__ import print_function
import argparse
import json

View File

@@ -1,4 +1,3 @@
import io
import json
import os
import time
@@ -178,7 +177,7 @@ def pytest_runtest_makereport(item, call):
for f in files:
path = os.path.join(root, f)
if pytest_html is not None:
with io.open(path, "r", encoding="utf8") as f:
with open(path, "r", encoding="utf8") as f:
extra.append(pytest_html.extras.text(f.read(), "Sync"))
report.sections.append(("Sync", "Log: {}".format(path)))
for log in ("Firefox", "TPS", "GradlewBuild"):
@@ -186,7 +185,7 @@ def pytest_runtest_makereport(item, call):
path = getattr(item.config, attr, None)
if path is not None and os.path.exists(path):
if pytest_html is not None:
with io.open(path, "r", encoding="utf8") as f:
with open(path, "r", encoding="utf8") as f:
extra.append(pytest_html.extras.text(f.read(), log))
report.sections.append((log, "Log: {}".format(path)))
report.extra = extra

View File

@@ -124,7 +124,7 @@ def load_results_file(filename):
print(f"Error parsing {filename} file: {e}")
finally:
f.close()
except IOError as e:
except OSError as e:
print(e)
return ret

View File

@@ -1,6 +1,5 @@
#!/usr/bin/python3
from __future__ import print_function
import argparse
import json

View File

@@ -124,7 +124,7 @@ def load_results_file(filename):
print(f"Error parsing {filename} file: {e}")
finally:
f.close()
except IOError as e:
except OSError as e:
print(e)
return ret

View File

@@ -1,6 +1,5 @@
#!/usr/bin/python3
from __future__ import print_function
import argparse
import json

View File

@@ -439,7 +439,7 @@ def emit_code(fd, pref_list_filename):
os.environ.get("GECKO_PATH", os.environ.get("TOPSRCDIR")),
)
code = generate_code(pref_list, input_file)
except (IOError, ValueError) as e:
except (OSError, ValueError) as e:
print("{}: error:\n {}\n".format(pref_list_filename, e))
sys.exit(1)

View File

@@ -722,7 +722,7 @@ class CommandSiteManager:
pip_command(python_executable=self.python_path, subcommand="check"),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
text=True,
)
if not check_result.returncode:
@@ -781,7 +781,7 @@ class CommandSiteManager:
pip_command(python_executable=self.python_path, subcommand="check"),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
text=True,
)
if check_result.returncode:
@@ -1265,9 +1265,8 @@ def _resolve_installed_packages(python_executable):
args=["--format", "json"],
non_uv_args=["--disable-pip-version-check"],
),
universal_newlines=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
capture_output=True,
check=True,
)
@@ -1334,8 +1333,7 @@ def _assert_pip_check(pthfile_lines, virtualenv_name, requirements):
# changes recently).
process = subprocess.run(
[sys.executable, "-m", "venv", "--without-pip", check_env_path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
capture_output=True,
encoding="UTF-8",
)
@@ -1383,7 +1381,7 @@ def _assert_pip_check(pthfile_lines, virtualenv_name, requirements):
pip + ["check"],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
text=True,
)
if check_result.returncode:
subprocess.check_call(pip + ["list", "-v"], stdout=sys.stderr)
@@ -1446,8 +1444,7 @@ def _create_venv_with_pthfile(
process = subprocess.run(
[sys.executable, "-m", "venv", "--without-pip", virtualenv_root],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
capture_output=True,
encoding="UTF-8",
)

View File

@@ -2,21 +2,15 @@
# 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/.
import sys
import unittest
from collections.abc import Iterable
from io import StringIO
from pathlib import Path
from typing import List, Optional, Union
import pytest
from buildconfig import topsrcdir
try:
from StringIO import StringIO
except ImportError:
# TODO io.StringIO causes failures with Python 2 (needs to be sorted out)
from io import StringIO
from mach.command_util import load_commands_from_entry_point, load_commands_from_file
from mach.main import Mach
@@ -64,10 +58,6 @@ def run_mach(request, get_mach):
stdout = StringIO()
stderr = StringIO()
if sys.version_info < (3, 0):
stdout.encoding = "UTF-8"
stderr.encoding = "UTF-8"
try:
result = m.run(argv, stdout=stdout, stderr=stderr)
except SystemExit:

View File

@@ -363,7 +363,7 @@ def _run_activation_script(
str(Path(__file__).parent / "script_site_activation.py"),
],
stdout=subprocess.PIPE,
universal_newlines=True,
text=True,
env={
"TOPSRCDIR": str(context.topsrcdir),
"COMMAND_SITE": site_name,
@@ -426,7 +426,7 @@ def _sys_path_of_virtualenv(virtualenv: PythonVirtualenv) -> List[Path]:
output = subprocess.run(
[virtualenv.python_path, "-c", "import sys; print(sys.path)"],
stdout=subprocess.PIPE,
universal_newlines=True,
text=True,
env={
# Needed for python to initialize properly
"SYSTEMROOT": os.environ.get("SYSTEMROOT", ""),

View File

@@ -46,7 +46,7 @@ def python(
command_context.log_manager.terminal_handler.setLevel(logging.CRITICAL)
# Note: subprocess requires native strings in os.environ on Windows.
append_env = {"PYTHONDONTWRITEBYTECODE": str("1")}
append_env = {"PYTHONDONTWRITEBYTECODE": "1"}
if virtualenv:
command_context._virtualenv_name = virtualenv
@@ -330,7 +330,7 @@ def _run_python_test(command_context, test, jobs, verbose):
env=env,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
text=True,
encoding="UTF-8",
)

View File

@@ -439,7 +439,7 @@ class BaseBootstrapper(object):
process = subprocess.run(
[str(path), version_param],
env=env,
universal_newlines=True,
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)

View File

@@ -143,7 +143,7 @@ def main(argv):
# Ensure that we don't overwrite the file if the script failed.
output.avoid_writing_to_file()
except IOError as e:
except OSError as e:
print('Error opening file "{0}"'.format(e.filename), file=sys.stderr)
traceback.print_exc()
return 1

View File

@@ -13,7 +13,6 @@
import argparse
import datetime
import io
import json
import logging
import os
@@ -34,7 +33,7 @@ from mozbuild.configure.util import Version
def write_file(path, content):
with io.open(path, "w", encoding="utf-8") as out:
with open(path, "w", encoding="utf-8") as out:
out.write(content + "\n")

View File

@@ -44,7 +44,6 @@ import time
import zipfile
from contextlib import closing, contextmanager
from functools import wraps
from io import open
from random import random
from subprocess import PIPE, Popen
@@ -62,6 +61,7 @@ DEFAULT_MANIFEST_NAME = "manifest.tt"
TOOLTOOL_PACKAGE_SUFFIX = ".TOOLTOOL-PACKAGE"
HAWK_VER = 1
import builtins
import urllib.request as urllib2
from http.client import HTTPConnection, HTTPSConnection
from urllib.error import HTTPError, URLError
@@ -508,7 +508,7 @@ class FileRecord(object):
def validate_digest(self):
if self.present():
with open(self.filename, "rb") as f:
with builtins.open(self.filename, "rb") as f:
return self.digest == digest_file(f, self.algorithm)
else:
log.debug("trying to validate digest on a missing file, %s', self.filename")
@@ -530,7 +530,7 @@ class FileRecord(object):
def create_file_record(filename, algorithm):
fo = open(filename, "rb")
fo = builtins.open(filename, "rb")
stored_filename = os.path.split(filename)[1]
fr = FileRecord(
stored_filename,
@@ -741,7 +741,7 @@ def open_manifest(manifest_file):
"""I know how to take a filename and load it into a Manifest object"""
if os.path.exists(manifest_file):
manifest = Manifest()
with open(manifest_file, "r") as f:
with builtins.open(manifest_file, "r") as f:
manifest.load(f)
log.debug("loaded manifest from file '%s'" % manifest_file)
return manifest
@@ -847,7 +847,7 @@ def add_files(manifest_file, algorithm, filenames, version, visibility, unpack):
if old_fr.filename not in new_filenames:
new_manifest.file_records.append(old_fr)
with open(manifest_file, mode="w") as output:
with builtins.open(manifest_file, mode="w") as output:
new_manifest.dump(output, fmt="json")
return all_files_added
@@ -895,7 +895,9 @@ def fetch_file(base_urls, file_record, grabchunk=1024 * 4, auth_file=None, regio
# Well, the file doesn't exist locally. Let's fetch it.
try:
with request(url, auth_file) as f, open(temp_path, mode="wb") as out:
with request(url, auth_file) as f, builtins.open(
temp_path, mode="wb"
) as out:
k = True
size = 0
while k:
@@ -917,7 +919,7 @@ def fetch_file(base_urls, file_record, grabchunk=1024 * 4, auth_file=None, regio
"...failed to fetch '%s' from %s" % (file_record.filename, base_url),
exc_info=True,
)
except IOError: # pragma: no cover
except OSError: # pragma: no cover
log.info(
"failed to write to temporary file for '%s'" % file_record.filename,
exc_info=True,
@@ -1048,7 +1050,7 @@ def unpack_file(filename):
clean_path(base_file)
log.info('untarring "%s"' % filename)
dctx = zstandard.ZstdDecompressor()
with dctx.stream_reader(open(filename, "rb")) as fileobj:
with dctx.stream_reader(builtins.open(filename, "rb")) as fileobj:
with TarFile.open(fileobj=fileobj, mode="r|") as tar:
safe_extract(tar)
elif os.path.isfile(filename) and zipfile.is_zipfile(filename):
@@ -1143,7 +1145,7 @@ def fetch_files(
)
os.remove(os.path.join(os.getcwd(), f.filename))
os.remove(os.path.join(cache_folder, f.digest))
except IOError:
except OSError:
log.info(
"File %s not present in local cache folder %s"
% (f.filename, cache_folder)
@@ -1211,7 +1213,7 @@ def fetch_files(
% (cache_folder, localfile.filename)
)
touch(os.path.join(cache_folder, localfile.digest))
except (OSError, IOError):
except OSError:
log.warning(
"Impossible to add file %s to cache folder %s"
% (localfile.filename, cache_folder),
@@ -1304,7 +1306,7 @@ def _authorize(req, auth_file):
except KeyError:
return
else:
with open(auth_file) as f:
with builtins.open(auth_file) as f:
auth_content = f.read().strip()
try:
auth_content = json.loads(auth_content)
@@ -1345,7 +1347,7 @@ def _s3_upload(filename, file):
conn = cls(host, port)
try:
req_path = "%s?%s" % (url.path, url.query) if url.query else url.path
with open(filename, "rb") as f:
with builtins.open(filename, "rb") as f:
content_length = file["size"]
conn.request(
"PUT",

View File

@@ -125,7 +125,7 @@ class ArtifactPersistLimit(dlmanager.PersistLimit):
continue
try:
fs.remove(f.path)
except WindowsError:
except OSError:
# For some reason, on automation, we can't remove those files.
# So for now, ignore the error.
kept.append(f)

View File

@@ -2,7 +2,6 @@
# 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 __future__ import absolute_import
import argparse
import hashlib

View File

@@ -778,7 +778,7 @@ class MacArtifactJob(ArtifactJob):
os.chdir(oldcwd)
try:
shutil.rmtree(tempdir)
except (OSError, IOError):
except OSError:
self.log(
logging.WARN,
"artifact",

View File

@@ -2,7 +2,6 @@
# 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/.
import io
import itertools
import os
import time
@@ -141,13 +140,13 @@ class BuildBackend(LoggingMixin):
for path in delete_files:
full_path = mozpath.join(self.environment.topobjdir, path)
try:
with io.open(full_path, mode="r", encoding="utf-8") as existing:
with open(full_path, mode="r", encoding="utf-8") as existing:
old_content = existing.read()
if old_content:
self.file_diffs[full_path] = simple_diff(
full_path, old_content.splitlines(), None
)
except IOError:
except OSError:
pass
try:
if not self.dry_run:

View File

@@ -218,7 +218,7 @@ class PartialConfigDict(object):
try:
with open(self._config_track) as fh:
existing_files.update(fh.read().splitlines())
except IOError:
except OSError:
pass
return existing_files
@@ -268,7 +268,7 @@ class PartialConfigDict(object):
self._files.add(filename)
with open(filename) as f:
data = json.load(f)
except IOError:
except OSError:
pass
self._dict[key] = data

View File

@@ -2,7 +2,6 @@
# 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/.
import io
import logging
import os
import re
@@ -992,7 +991,7 @@ class RecursiveMakeBackend(MakeBackend):
obj.topobjdir = bf.environment.topobjdir
obj.config = bf.environment
self._create_makefile(obj, stub=stub)
with io.open(obj.output_path, encoding="utf-8") as fh:
with open(obj.output_path, encoding="utf-8") as fh:
content = fh.read()
# Directories with a Makefile containing a tools target, or
# XPI_PKGNAME can't be skipped and must run during the

View File

@@ -289,7 +289,7 @@ class VisualStudioBackend(CommonBackend):
for line in sfh:
if line.startswith(b"VisualStudioVersion = "):
vs_version = line.split(b" = ", 1)[1].strip()
except IOError as e:
except OSError as e:
if e.errno != errno.ENOENT:
raise

View File

@@ -141,7 +141,7 @@ class MozbuildObject(ProcessExecutionMixin):
mozconfig = MozconfigLoader.AUTODETECT
def load_mozinfo(path):
info = json.load(io.open(path, "rt", encoding="utf-8"))
info = json.load(open(path, "rt", encoding="utf-8"))
topsrcdir = info.get("topsrcdir")
topobjdir = os.path.dirname(path)
mozconfig = info.get("mozconfig")
@@ -207,7 +207,7 @@ class MozbuildObject(ProcessExecutionMixin):
return True
deps = []
with io.open(dep_file, "r", encoding="utf-8", newline="\n") as fh:
with open(dep_file, "r", encoding="utf-8", newline="\n") as fh:
deps = fh.read().splitlines()
mtime = os.path.getmtime(output)
@@ -232,7 +232,7 @@ class MozbuildObject(ProcessExecutionMixin):
# we last built the backend, re-generate the backend if
# so.
outputs = []
with io.open(backend_file, "r", encoding="utf-8", newline="\n") as fh:
with open(backend_file, "r", encoding="utf-8", newline="\n") as fh:
outputs = fh.read().splitlines()
for output in outputs:
if not os.path.isfile(mozpath.join(self.topobjdir, output)):

View File

@@ -22,7 +22,6 @@ import yaml
from mach.decorators import Command, CommandArgument, SubCommand
from mach.main import Mach
from mozversioncontrol import get_repository_object
from six.moves import input
from mozbuild import build_commands
from mozbuild.controller.clobber import Clobberer

View File

@@ -435,7 +435,7 @@ class UrlFinder(object):
try:
with open(chrome_map_path, "r", encoding="utf-8") as fh:
url_prefixes, overrides, install_info, buildconfig = json.load(fh)
except IOError:
except OSError:
print(
"Error reading %s. Run |./mach build-backend -b ChromeMap| to "
"populate the ChromeMap backend." % chrome_map_path

View File

@@ -18,7 +18,7 @@ def describe_install_manifest(manifest, dest_dir):
try:
manifest = InstallManifest(manifest)
except UnreadableInstallManifest:
raise IOError(errno.EINVAL, "Error parsing manifest file", manifest)
raise OSError(errno.EINVAL, "Error parsing manifest file", manifest)
reg = FileRegistry()

View File

@@ -4,7 +4,6 @@
# This modules provides functionality for dealing with compiler warnings.
import io
import json
import os
import re
@@ -276,14 +275,14 @@ class WarningsDatabase(object):
def load_from_file(self, filename):
"""Load the database from a file."""
with io.open(filename, "r", encoding="utf-8") as fh:
with open(filename, "r", encoding="utf-8") as fh:
self.deserialize(fh)
def save_to_file(self, filename):
"""Save the database to a file."""
# Ensure the directory exists
os.makedirs(os.path.dirname(filename), exist_ok=True)
with io.open(filename, "w", encoding="utf-8", newline="\n") as fh:
with open(filename, "w", encoding="utf-8", newline="\n") as fh:
self.serialize(fh)

View File

@@ -151,7 +151,7 @@ class ConfigureOutputHandler(logging.Handler):
msg = "%s\n" % self.format(record)
stream.write(msg)
stream.flush()
except (KeyboardInterrupt, SystemExit, IOError):
except (OSError, KeyboardInterrupt, SystemExit):
raise
except Exception:
self.handleError(record)

View File

@@ -359,7 +359,7 @@ class BuildMonitor(MozbuildObject):
build_resources_profile_path = self._get_state_filename(
"profile_build_resources.json"
)
with io.open(
with open(
build_resources_profile_path, "w", encoding="utf-8", newline="\n"
) as fh:
to_write = six.ensure_text(
@@ -775,7 +775,7 @@ class StaticAnalysisOutputManager(OutputManager):
self.monitor._warnings_database.save_to_file(path)
else:
with io.open(path, "w", encoding="utf-8", newline="\n") as f:
with open(path, "w", encoding="utf-8", newline="\n") as f:
f.write(self.raw)
self.log(
@@ -1422,9 +1422,9 @@ class BuildDriver(MozbuildObject):
)
if os.path.exists(pathToThirdparty):
with io.open(
pathToThirdparty, encoding="utf-8", newline="\n"
) as f, io.open(pathToGenerated, encoding="utf-8", newline="\n") as g:
with open(pathToThirdparty, encoding="utf-8", newline="\n") as f, open(
pathToGenerated, encoding="utf-8", newline="\n"
) as g:
# Normalize the path (no trailing /)
LOCAL_SUPPRESS_DIRS = tuple(
[line.strip("\n/") for line in f]

View File

@@ -226,7 +226,7 @@ class Clobberer(object):
self.remove_objdir(False)
print("Successfully completed auto clobber.", file=fh)
return True, True, None
except IOError as error:
except OSError as error:
return (
True,
False,

View File

@@ -141,8 +141,7 @@ def ssh(**kwargs) -> DoctorCheck:
proc = subprocess.run(
["ssh", "hg.mozilla.org"],
encoding="utf-8",
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
capture_output=True,
)
# Command output from a successful `pash` run.
@@ -451,7 +450,7 @@ def mozillabuild(**kwargs) -> DoctorCheck:
status = CheckStatus.OK
desc = "MozillaBuild %s in use" % local_version
except (IOError, ValueError):
except (OSError, ValueError):
status = CheckStatus.FATAL
desc = "MozillaBuild version not found"

View File

@@ -501,7 +501,7 @@ class JarMaker(object):
if e.preprocess:
outf = outHelper.getOutput(out, mode="w")
inf = io.open(realsrc, encoding="utf-8")
inf = open(realsrc, encoding="utf-8")
pp = self.pp.clone()
if src[-4:] == ".css":
pp.setMarker("%")
@@ -567,9 +567,9 @@ class JarMaker(object):
if e.errno != errno.ENOENT:
raise
if "b" in mode:
return io.open(out, mode)
return open(out, mode)
else:
return io.open(out, mode, encoding="utf-8", newline="\n")
return open(out, mode, encoding="utf-8", newline="\n")
def ensureDirFor(self, name):
out = os.path.join(self.basepath, name)

View File

@@ -505,7 +505,7 @@ class Preprocessor:
if dir:
os.makedirs(dir, exist_ok=True)
return io.open(path, "w", encoding=encoding, newline="\n")
return open(path, "w", encoding=encoding, newline="\n")
p = self.getCommandLineParser()
options, args = p.parse_args(args=args)
@@ -532,7 +532,7 @@ class Preprocessor:
if args:
for f in args:
if not isinstance(f, io.TextIOBase):
f = io.open(f, "r", encoding="utf-8")
f = open(f, "r", encoding="utf-8")
with f as input_:
self.processFile(input=input_, output=out)
if depfile:
@@ -868,7 +868,7 @@ class Preprocessor:
args = self.applyFilters(args)
if not os.path.isabs(args):
args = os.path.join(self.curdir, args)
args = io.open(args, "r", encoding="utf-8")
args = open(args, "r", encoding="utf-8")
except Preprocessor.Error:
raise
except Exception:
@@ -922,7 +922,7 @@ class Preprocessor:
def preprocess(includes=[sys.stdin], defines={}, output=sys.stdout, marker="#"):
pp = Preprocessor(defines=defines, marker=marker)
for f in includes:
with io.open(f, "r", encoding="utf-8") as input:
with open(f, "r", encoding="utf-8") as input:
pp.processFile(input=input, output=output)
return pp.includes

View File

@@ -735,7 +735,7 @@ def repackage_msix(
# provide more feedback, so we prefer invoking with these flags. This will
# also accommodate `wine makeappx.exe`.
stdout = subprocess.run(
[makeappx], check=False, capture_output=True, universal_newlines=True
[makeappx], check=False, capture_output=True, text=True
).stdout
is_makeappx = "MakeAppx Tool" in stdout
@@ -774,9 +774,7 @@ def _sign_msix_win(output, force, log, verbose):
log(
logging.INFO, "msix", {"args": args, "joined": joined}, "Invoking: {joined}"
)
return subprocess.run(
args, check=check, universal_newlines=True, capture_output=True
).stdout
return subprocess.run(args, check=check, text=True, capture_output=True).stdout
signtool = find_sdk_tool("signtool.exe", log=log)
if not signtool:
@@ -1013,7 +1011,7 @@ def _sign_msix_posix(output, force, log, verbose):
full_args,
check=check,
capture_output=capture_output,
universal_newlines=True,
text=True,
)
# These are baked into enough places under `browser/` that we need not

View File

@@ -44,7 +44,7 @@ def cpu_brand_windows():
(brand, ty) = _winreg.QueryValueEx(h, "ProcessorNameString")
if ty == _winreg.REG_SZ:
return brand
except WindowsError:
except OSError:
pass
return None

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/

View File

@@ -2,7 +2,6 @@
# 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/.
import io
import os
import unittest
@@ -1312,7 +1311,7 @@ class TestRecursiveMakeBackend(BackendTester):
]
prefix = "PROGRAM = "
for subdir, expected_program in expected:
with io.open(os.path.join(env.topobjdir, subdir, "backend.mk"), "r") as fh:
with open(os.path.join(env.topobjdir, subdir, "backend.mk"), "r") as fh:
lines = fh.readlines()
program = [
line.rstrip().split(prefix, 1)[1]
@@ -1334,7 +1333,7 @@ class TestRecursiveMakeBackend(BackendTester):
]
prefix = "SHARED_LIBRARY := "
for subdir, expected_shared_lib in expected:
with io.open(os.path.join(env.topobjdir, subdir, "backend.mk"), "r") as fh:
with open(os.path.join(env.topobjdir, subdir, "backend.mk"), "r") as fh:
lines = fh.readlines()
shared_lib = [
line.rstrip().split(prefix, 1)[1]

View File

@@ -162,7 +162,7 @@ class ConfigureTestSandbox(ConfigureSandbox):
@memoized_property
def _wrapped__winreg(self):
def OpenKey(*args, **kwargs):
raise WindowsError()
raise OSError()
return ReadOnlyNamespace(HKEY_LOCAL_MACHINE=0, OpenKey=OpenKey)

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import os
import unittest

View File

@@ -1,4 +1,3 @@
# coding: utf-8
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

View File

@@ -1,4 +1,3 @@
# coding: utf-8
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
@@ -40,10 +39,7 @@ from mozbuild.util import (
resolve_target_to_make,
)
if sys.version_info[0] == 3:
str_type = "str"
else:
str_type = "unicode"
str_type = "str"
data_path = os.path.abspath(os.path.dirname(__file__))
data_path = os.path.join(data_path, "data")

View File

@@ -11,7 +11,6 @@ import copy
import difflib
import functools
import hashlib
import io
import itertools
import os
import re
@@ -41,8 +40,8 @@ else:
def _open(path, mode):
if "b" in mode:
return io.open(path, mode)
return io.open(path, mode, encoding="utf-8", newline="\n")
return open(path, mode)
return open(path, mode, encoding="utf-8", newline="\n")
def hash_file(path, hasher=None):
@@ -229,14 +228,14 @@ class FileAvoidWrite(BytesIO):
try:
existing = _open(self.name, self.mode)
existed = True
except IOError:
except OSError:
pass
else:
try:
old_content = existing.read()
if old_content == buf:
return True, False
except IOError:
except OSError:
pass
finally:
existing.close()

View File

@@ -44,9 +44,8 @@ class BaseHost:
self.manifest["vendoring"]["url"],
self.manifest["origin"]["name"],
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
capture_output=True,
text=True,
check=True,
)
os.chdir("/".join([temp_repo_clone, self.manifest["origin"]["name"]]))
@@ -58,9 +57,8 @@ class BaseHost:
tag = subprocess.run(
["git", "--no-pager", "tag", "-l", "--sort=creatordate"]
+ revision_arg,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
capture_output=True,
text=True,
check=True,
).stdout.splitlines()[-1]
except IndexError: # 0 lines of output, the tag does not exist
@@ -78,9 +76,8 @@ class BaseHost:
"--format=%cd",
tag,
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
capture_output=True,
text=True,
check=True,
).stdout.splitlines()[-1]
os.chdir(starting_directory)

View File

@@ -87,7 +87,7 @@ def load_moz_yaml(filename, verify=True, require_license_file=True):
try:
with open(filename, "r") as f:
manifest = yaml.load(f, Loader=yaml.BaseLoader)
except IOError as e:
except OSError as e:
if e.errno == errno.ENOENT:
raise MozYamlVerifyError(filename, "Failed to find manifest: %s" % filename)
raise

View File

@@ -405,14 +405,14 @@ class AbsoluteSymlinkFile(File):
os.symlink(self.path, temp_dest)
# TODO Figure out exactly how symlink creation fails and only trap
# that.
except EnvironmentError:
except OSError:
return File.copy(self, dest, skip_if_older=skip_if_older)
# If removing the original file fails, don't forget to clean up the
# temporary symlink.
try:
os.remove(dest)
except EnvironmentError:
except OSError:
os.remove(temp_dest)
raise

View File

@@ -71,7 +71,7 @@ class TestWithTmpDir(unittest.TestCase):
try:
os.symlink(dummy_path, self.tmppath("dummy_symlink"))
os.remove(self.tmppath("dummy_symlink"))
except EnvironmentError:
except OSError:
pass
finally:
os.remove(dummy_path)
@@ -86,7 +86,7 @@ class TestWithTmpDir(unittest.TestCase):
try:
os.link(dummy_path, self.tmppath("dummy_hardlink"))
os.remove(self.tmppath("dummy_hardlink"))
except EnvironmentError:
except OSError:
pass
finally:
os.remove(dummy_path)

View File

@@ -36,7 +36,7 @@ class Hooks(MachLogger):
_LOADED_MODULES[path] = hook_module
self._hooks = _LOADED_MODULES[path]
else:
raise IOError("Could not find hook module. %s" % str(hook_module))
raise OSError("Could not find hook module. %s" % str(hook_module))
def cleanup(self):
if self.tmp_dir is None:

View File

@@ -82,7 +82,7 @@ class MacosDevice(Layer):
shutil.rmtree(str(mount))
if not found:
self.error(f"No app file found in {dmg}")
raise IOError(dmg)
raise OSError(dmg)
def run(self, metadata):
# Each DMG is mounted, then we look for the .app

View File

@@ -582,7 +582,7 @@ _WPT_URL = "{0}/secrets/v1/secret/project/perftest/gecko/level-{1}/perftest-logi
_DEFAULT_SERVER = "https://firefox-ci-tc.services.mozilla.com"
@functools.lru_cache()
@functools.lru_cache
def get_tc_secret(wpt=False):
"""Returns the Taskcluster secret.

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

View File

@@ -300,7 +300,7 @@ def retrieveFile(url, file_path: Path):
StrictFancyURLopener().retrieve,
kwargs=dict(url=url, filename=str(file_path)),
)
except IOError:
except OSError:
log.error("Error downloading %s" % url, exc_info=True)
success = False
try:

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

View File

@@ -57,7 +57,7 @@ def runUtil(util, args):
proc = subprocess.run(
[util] + args,
env=env,
universal_newlines=True,
text=True,
)
return proc.returncode

Some files were not shown because too many files have changed in this diff Show More