SHA256
1
0
forked from pool/webkit2gtk3
webkit2gtk3/webkit2gtk3-python3.patch

1879 lines
100 KiB
Diff

diff -ur webkitgtk-2.19.91.orig/Source/cmake/WebKitCommon.cmake webkitgtk-2.19.91/Source/cmake/WebKitCommon.cmake
--- webkitgtk-2.19.91.orig/Source/cmake/WebKitCommon.cmake 2018-02-19 01:45:33.000000000 -0600
+++ webkitgtk-2.19.91/Source/cmake/WebKitCommon.cmake 2018-03-02 16:23:17.684067947 -0600
@@ -21,9 +21,6 @@
find_package(PerlModules COMPONENTS JSON::PP REQUIRED)
find_package(PythonInterp 2.7.0 REQUIRED)
- if (PYTHON_VERSION_MAJOR GREATER 2)
- message(FATAL_ERROR "Python 2 is required, but Python ${PYTHON_VERSION_MAJOR} was found.")
- endif ()
# We cannot check for RUBY_FOUND because it is set only when the full package is installed and
# the only thing we need is the interpreter. Unlike Python, cmake does not provide a macro
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/disassembler/udis86/ud_opcode.py webkitgtk-2.19.91/Source/JavaScriptCore/disassembler/udis86/ud_opcode.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/disassembler/udis86/ud_opcode.py 2018-02-19 01:45:14.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/disassembler/udis86/ud_opcode.py 2018-03-02 16:25:53.748926795 -0600
@@ -550,10 +550,10 @@
entries = tbl.entries()
for k, e in entries:
if isinstance(e, UdOpcodeTable):
- self.log("%s |-<%02x> %s" % (indent, k, e))
+ self.log("%s |-<%02x> %s" % (indent, int(k), e))
printWalk(e, indent + " |")
elif isinstance(e, UdInsnDef):
- self.log("%s |-<%02x> %s" % (indent, k, e))
+ self.log("%s |-<%02x> %s" % (indent, int(k), e))
printWalk(self.root)
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/generate-bytecode-files webkitgtk-2.19.91/Source/JavaScriptCore/generate-bytecode-files
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/generate-bytecode-files 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/generate-bytecode-files 2018-03-02 16:23:17.688067969 -0600
@@ -94,6 +94,12 @@
print("I/O error opening {0}, ({1}): {2}".format(path, e.errno, e.strerror))
exit(1)
+def dowrite(file, str):
+ if sys.version_info.major == 2:
+ file.write(str)
+ else:
+ file.write(bytes(str, "utf-8"))
+
def hashFile(file):
sha1 = hashlib.sha1()
file.seek(0)
@@ -112,31 +118,31 @@
def writeInstructionAccessor(bytecodeHFile, typeName, name):
- bytecodeHFile.write(" {0}& {1}() {{ return *reinterpret_cast<{0}*>(&m_{1}); }}\n".format(typeName, name))
- bytecodeHFile.write(" const {0}& {1}() const {{ return *reinterpret_cast<const {0}*>(&m_{1}); }}\n".format(typeName, name))
+ dowrite(bytecodeHFile, " {0}& {1}() {{ return *reinterpret_cast<{0}*>(&m_{1}); }}\n".format(typeName, name))
+ dowrite(bytecodeHFile, " const {0}& {1}() const {{ return *reinterpret_cast<const {0}*>(&m_{1}); }}\n".format(typeName, name))
def writeInstructionMember(bytecodeHFile, typeName, name):
- bytecodeHFile.write(" std::aligned_storage<sizeof({0}), sizeof(Instruction)>::type m_{1};\n".format(typeName, name))
+ dowrite(bytecodeHFile, " std::aligned_storage<sizeof({0}), sizeof(Instruction)>::type m_{1};\n".format(typeName, name))
def writeStruct(bytecodeHFile, bytecode):
- bytecodeHFile.write("struct {0} {{\n".format(toCpp(bytecode["name"])))
- bytecodeHFile.write("public:\n")
+ dowrite(bytecodeHFile, "struct {0} {{\n".format(toCpp(bytecode["name"])))
+ dowrite(bytecodeHFile, "public:\n")
writeInstructionAccessor(bytecodeHFile, "Opcode", "opcode")
for offset in bytecode["offsets"]:
- for name, typeName in offset.iteritems():
+ for name, typeName in offset.items():
writeInstructionAccessor(bytecodeHFile, typeName, name)
- bytecodeHFile.write("\nprivate:\n")
- bytecodeHFile.write(" friend class LLIntOffsetsExtractor;\n\n")
+ dowrite(bytecodeHFile, "\nprivate:\n")
+ dowrite(bytecodeHFile, " friend class LLIntOffsetsExtractor;\n\n")
writeInstructionMember(bytecodeHFile, "Opcode", "opcode")
for offset in bytecode["offsets"]:
- for name, typeName in offset.iteritems():
+ for name, typeName in offset.items():
writeInstructionMember(bytecodeHFile, typeName, name)
- bytecodeHFile.write("};\n\n")
+ dowrite(bytecodeHFile, "};\n\n")
if __name__ == "__main__":
@@ -220,25 +226,25 @@
print("Unexpected error parsing {0}: {1}".format(bytecodeJSONFile, sys.exc_info()))
if bytecodeHFilename:
- bytecodeHFile.write(hFileHashString)
- bytecodeHFile.write(cCopyrightMsg % bytecodeJSONFile)
- bytecodeHFile.write("#pragma once\n\n")
+ dowrite(bytecodeHFile, hFileHashString)
+ dowrite(bytecodeHFile, cCopyrightMsg % bytecodeJSONFile)
+ dowrite(bytecodeHFile, "#pragma once\n\n")
if bytecodeStructsHFilename:
- bytecodeStructsHFile.write(hFileHashString)
- bytecodeStructsHFile.write(cCopyrightMsg % bytecodeJSONFile)
- bytecodeStructsHFile.write("#pragma once\n\n")
- bytecodeStructsHFile.write("#include \"Instruction.h\"\n")
- bytecodeStructsHFile.write("\n")
+ dowrite(bytecodeStructsHFile, hFileHashString)
+ dowrite(bytecodeStructsHFile, cCopyrightMsg % bytecodeJSONFile)
+ dowrite(bytecodeStructsHFile, "#pragma once\n\n")
+ dowrite(bytecodeStructsHFile, "#include \"Instruction.h\"\n")
+ dowrite(bytecodeStructsHFile, "\n")
if initASMFileName:
- initBytecodesFile.write(asmFileHashString)
- initBytecodesFile.write(asmCopyrightMsg % bytecodeJSONFile)
+ dowrite(initBytecodesFile, asmFileHashString)
+ dowrite(initBytecodesFile, asmCopyrightMsg % bytecodeJSONFile)
initASMBytecodeNum = 0
for section in bytecodeSections:
if bytecodeHFilename and section['emitInHFile']:
- bytecodeHFile.write("#define FOR_EACH_{0}_ID(macro) \\\n".format(section["macroNameComponent"]))
+ dowrite(bytecodeHFile, "#define FOR_EACH_{0}_ID(macro) \\\n".format(section["macroNameComponent"]))
firstMacro = True
defaultLength = 1
if "defaultLength" in section:
@@ -247,7 +253,7 @@
bytecodeNum = 0
for bytecode in section["bytecodes"]:
if not firstMacro:
- bytecodeHFile.write(" \\\n")
+ dowrite(bytecodeHFile, " \\\n")
length = defaultLength
if "length" in bytecode:
@@ -256,39 +262,39 @@
# Add one for the opcode
length = len(bytecode["offsets"]) + 1
- bytecodeHFile.write(" macro({0}, {1})".format(bytecode["name"], length))
+ dowrite(bytecodeHFile, " macro({0}, {1})".format(bytecode["name"], length))
firstMacro = False
bytecodeNum = bytecodeNum + 1
- bytecodeHFile.write("\n\n")
- bytecodeHFile.write("#define NUMBER_OF_{0}_IDS {1}\n\n".format(section["macroNameComponent"], bytecodeNum))
+ dowrite(bytecodeHFile, "\n\n")
+ dowrite(bytecodeHFile, "#define NUMBER_OF_{0}_IDS {1}\n\n".format(section["macroNameComponent"], bytecodeNum))
if bytecodeStructsHFilename and section['emitInStructsFile']:
- bytecodeStructsHFile.write("namespace JSC {\n\n")
+ dowrite(bytecodeStructsHFile, "namespace JSC {\n\n")
for bytecode in section["bytecodes"]:
if not "offsets" in bytecode:
continue
writeStruct(bytecodeStructsHFile, bytecode)
- bytecodeStructsHFile.write("} // namespace JSC \n")
+ dowrite(bytecodeStructsHFile, "} // namespace JSC \n")
if bytecodeHFilename and section['emitOpcodeIDStringValuesInHFile']:
bytecodeNum = 0
for bytecode in section["bytecodes"]:
- bytecodeHFile.write("#define {0}_value_string \"{1}\"\n".format(bytecode["name"], bytecodeNum))
+ dowrite(bytecodeHFile, "#define {0}_value_string \"{1}\"\n".format(bytecode["name"], bytecodeNum))
firstMacro = False
bytecodeNum = bytecodeNum + 1
- bytecodeHFile.write("\n")
+ dowrite(bytecodeHFile, "\n")
if initASMFileName and section['emitInASMFile']:
prefix = ""
if "asmPrefix" in section:
prefix = section["asmPrefix"]
for bytecode in section["bytecodes"]:
- initBytecodesFile.write("setEntryAddress({0}, _{1}{2})\n".format(initASMBytecodeNum, prefix, bytecode["name"]))
+ dowrite(initBytecodesFile, "setEntryAddress({0}, _{1}{2})\n".format(initASMBytecodeNum, prefix, bytecode["name"]))
initASMBytecodeNum = initASMBytecodeNum + 1
if bytecodeHFilename:
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py 2018-03-03 10:29:27.006362019 -0600
@@ -28,8 +28,8 @@
import os.path
import re
-from generator import ucfirst, Generator
-from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks
+from .generator import ucfirst, Generator
+from .models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks
log = logging.getLogger('global')
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py 2018-02-19 04:47:53.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py 2018-03-03 10:29:27.042362171 -0600
@@ -30,8 +30,8 @@
import re
from string import Template
-from cpp_generator import CppGenerator
-from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from .cpp_generator import CppGenerator
+from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates
log = logging.getLogger('global')
@@ -52,7 +52,7 @@
sections = []
sections.append(self.generate_license())
sections.append(Template(CppTemplates.AlternateDispatchersHeaderPrelude).substitute(None, **template_args))
- sections.append('\n'.join(filter(None, map(self._generate_handler_declarations_for_domain, domains))))
+ sections.append('\n'.join([_f for _f in map(self._generate_handler_declarations_for_domain, domains) if _f]))
sections.append(Template(CppTemplates.AlternateDispatchersHeaderPostlude).substitute(None, **template_args))
return '\n\n'.join(sections)
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py 2018-02-19 04:47:53.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py 2018-03-03 10:29:27.110362457 -0600
@@ -30,10 +30,10 @@
import string
from string import Template
-from cpp_generator import CppGenerator
-from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
-from generator import Generator, ucfirst
-from models import EnumType
+from .cpp_generator import CppGenerator
+from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from .generator import Generator, ucfirst
+from .models import EnumType
log = logging.getLogger('global')
@@ -46,7 +46,7 @@
return "%sBackendDispatchers.h" % self.protocol_name()
def domains_to_generate(self):
- return filter(lambda domain: len(self.commands_for_domain(domain)) > 0, Generator.domains_to_generate(self))
+ return [domain for domain in Generator.domains_to_generate(self) if len(self.commands_for_domain(domain)) > 0]
def generate_output(self):
typedefs = [('String', 'ErrorString')]
@@ -62,8 +62,8 @@
sections.append(Template(CppTemplates.HeaderPrelude).substitute(None, **header_args))
if self.model().framework.setting('alternate_dispatchers', False):
sections.append(self._generate_alternate_handler_forward_declarations_for_domains(domains))
- sections.extend(map(self._generate_handler_declarations_for_domain, domains))
- sections.extend(map(self._generate_dispatcher_declarations_for_domain, domains))
+ sections.extend(list(map(self._generate_handler_declarations_for_domain, domains)))
+ sections.extend(list(map(self._generate_dispatcher_declarations_for_domain, domains)))
sections.append(Template(CppTemplates.HeaderPostlude).substitute(None, **header_args))
return "\n\n".join(sections)
@@ -198,7 +198,7 @@
commands = self.commands_for_domain(domain)
if len(commands) > 0:
declarations.append('private:')
- declarations.extend(map(self._generate_dispatcher_declaration_for_command, commands))
+ declarations.extend(list(map(self._generate_dispatcher_declaration_for_command, commands)))
declaration_args = {
'domainName': domain.domain_name,
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py 2018-02-19 04:47:53.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py 2018-03-03 10:29:27.210362879 -0600
@@ -29,10 +29,10 @@
import string
from string import Template
-from cpp_generator import CppGenerator
-from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
-from generator import Generator, ucfirst
-from models import ObjectType, ArrayType
+from .cpp_generator import CppGenerator
+from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from .generator import Generator, ucfirst
+from .models import ObjectType, ArrayType
log = logging.getLogger('global')
@@ -45,7 +45,7 @@
return "%sBackendDispatchers.cpp" % self.protocol_name()
def domains_to_generate(self):
- return filter(lambda domain: len(self.commands_for_domain(domain)) > 0, Generator.domains_to_generate(self))
+ return [domain for domain in Generator.domains_to_generate(self) if len(self.commands_for_domain(domain)) > 0]
def generate_output(self):
secondary_includes = self._generate_secondary_header_includes()
@@ -65,7 +65,7 @@
sections.append(self.generate_license())
sections.append(Template(CppTemplates.ImplementationPrelude).substitute(None, **header_args))
sections.append("\n".join(map(self._generate_handler_class_destructor_for_domain, self.domains_to_generate())))
- sections.extend(map(self._generate_dispatcher_implementations_for_domain, self.domains_to_generate()))
+ sections.extend(list(map(self._generate_dispatcher_implementations_for_domain, self.domains_to_generate())))
sections.append(Template(CppTemplates.ImplementationPostlude).substitute(None, **header_args))
return "\n\n".join(sections)
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py 2018-02-19 04:47:53.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py 2018-03-03 10:29:27.250363047 -0600
@@ -30,10 +30,10 @@
import string
from string import Template
-from cpp_generator import CppGenerator
-from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
-from generator import Generator, ucfirst
-from models import EnumType
+from .cpp_generator import CppGenerator
+from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from .generator import Generator, ucfirst
+from .models import EnumType
log = logging.getLogger('global')
@@ -46,7 +46,7 @@
return "%sFrontendDispatchers.h" % self.protocol_name()
def domains_to_generate(self):
- return filter(lambda domain: len(self.events_for_domain(domain)) > 0, Generator.domains_to_generate(self))
+ return [domain for domain in Generator.domains_to_generate(self) if len(self.events_for_domain(domain)) > 0]
def generate_output(self):
header_args = {
@@ -57,7 +57,7 @@
sections = []
sections.append(self.generate_license())
sections.append(Template(CppTemplates.HeaderPrelude).substitute(None, **header_args))
- sections.extend(map(self._generate_dispatcher_declarations_for_domain, self.domains_to_generate()))
+ sections.extend(list(map(self._generate_dispatcher_declarations_for_domain, self.domains_to_generate())))
sections.append(Template(CppTemplates.HeaderPostlude).substitute(None, **header_args))
return "\n\n".join(sections)
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py 2018-02-19 04:47:53.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py 2018-03-03 10:29:27.286363199 -0600
@@ -29,10 +29,10 @@
import string
from string import Template
-from cpp_generator import CppGenerator
-from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
-from generator import Generator, ucfirst
-from models import ObjectType, ArrayType
+from .cpp_generator import CppGenerator
+from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from .generator import Generator, ucfirst
+from .models import ObjectType, ArrayType
log = logging.getLogger('global')
@@ -45,7 +45,7 @@
return "%sFrontendDispatchers.cpp" % self.protocol_name()
def domains_to_generate(self):
- return filter(lambda domain: len(self.events_for_domain(domain)) > 0, Generator.domains_to_generate(self))
+ return [domain for domain in Generator.domains_to_generate(self) if len(self.events_for_domain(domain)) > 0]
def generate_output(self):
header_args = {
@@ -56,7 +56,7 @@
sections = []
sections.append(self.generate_license())
sections.append(Template(CppTemplates.ImplementationPrelude).substitute(None, **header_args))
- sections.extend(map(self._generate_dispatcher_implementations_for_domain, self.domains_to_generate()))
+ sections.extend(list(map(self._generate_dispatcher_implementations_for_domain, self.domains_to_generate())))
sections.append(Template(CppTemplates.ImplementationPostlude).substitute(None, **header_args))
return "\n\n".join(sections)
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py 2018-02-19 04:47:53.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py 2018-03-03 10:29:27.418363755 -0600
@@ -31,10 +31,10 @@
from operator import methodcaller
from string import Template
-from cpp_generator import CppGenerator
-from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
-from generator import Generator, ucfirst
-from models import EnumType, ObjectType, PrimitiveType, AliasedType, ArrayType, Frameworks
+from .cpp_generator import CppGenerator
+from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from .generator import Generator, ucfirst
+from .models import EnumType, ObjectType, PrimitiveType, AliasedType, ArrayType, Frameworks
log = logging.getLogger('global')
@@ -62,8 +62,8 @@
sections.append(self._generate_forward_declarations(domains))
sections.append(self._generate_typedefs(domains))
sections.extend(self._generate_enum_constant_value_conversion_methods())
- builder_sections = map(self._generate_builders_for_domain, domains)
- sections.extend(filter(lambda section: len(section) > 0, builder_sections))
+ builder_sections = list(map(self._generate_builders_for_domain, domains))
+ sections.extend([section for section in builder_sections if len(section) > 0])
sections.append(self._generate_forward_declarations_for_binding_traits())
sections.extend(self._generate_declarations_for_enum_conversion_methods())
sections.append('} // namespace Protocol')
@@ -87,8 +87,8 @@
for domain in domains:
declaration_types = [decl.type for decl in self.type_declarations_for_domain(domain)]
- object_types = filter(lambda _type: isinstance(_type, ObjectType), declaration_types)
- enum_types = filter(lambda _type: isinstance(_type, EnumType), declaration_types)
+ object_types = [_type for _type in declaration_types if isinstance(_type, ObjectType)]
+ enum_types = [_type for _type in declaration_types if isinstance(_type, EnumType)]
sorted(object_types, key=methodcaller('raw_name'))
sorted(enum_types, key=methodcaller('raw_name'))
@@ -113,8 +113,8 @@
""" % '\n\n'.join(sections)
def _generate_typedefs(self, domains):
- sections = map(self._generate_typedefs_for_domain, domains)
- sections = filter(lambda text: len(text) > 0, sections)
+ sections = list(map(self._generate_typedefs_for_domain, domains))
+ sections = [text for text in sections if len(text) > 0]
if len(sections) == 0:
return ''
@@ -125,8 +125,8 @@
def _generate_typedefs_for_domain(self, domain):
type_declarations = self.type_declarations_for_domain(domain)
- primitive_declarations = filter(lambda decl: isinstance(decl.type, AliasedType), type_declarations)
- array_declarations = filter(lambda decl: isinstance(decl.type, ArrayType), type_declarations)
+ primitive_declarations = [decl for decl in type_declarations if isinstance(decl.type, AliasedType)]
+ array_declarations = [decl for decl in type_declarations if isinstance(decl.type, ArrayType)]
if len(primitive_declarations) == 0 and len(array_declarations) == 0:
return ''
@@ -186,7 +186,7 @@
elif isinstance(type_declaration.type, ObjectType):
sections.append(self._generate_class_for_object_declaration(type_declaration, domain))
- sections = filter(lambda section: len(section) > 0, sections)
+ sections = [section for section in sections if len(section) > 0]
if len(sections) == 0:
return ''
@@ -200,9 +200,9 @@
if len(type_declaration.type_members) == 0:
return ''
- enum_members = filter(lambda member: isinstance(member.type, EnumType) and member.type.is_anonymous, type_declaration.type_members)
- required_members = filter(lambda member: not member.is_optional, type_declaration.type_members)
- optional_members = filter(lambda member: member.is_optional, type_declaration.type_members)
+ enum_members = [member for member in type_declaration.type_members if isinstance(member.type, EnumType) and member.type.is_anonymous]
+ required_members = [member for member in type_declaration.type_members if not member.is_optional]
+ optional_members = [member for member in type_declaration.type_members if member.is_optional]
object_name = type_declaration.type_name
lines = []
@@ -261,7 +261,7 @@
else:
return ' ' + line
- indented_lines = map(apply_indentation, self._generate_struct_for_enum_type(enum_member.member_name, enum_member.type))
+ indented_lines = list(map(apply_indentation, self._generate_struct_for_enum_type(enum_member.member_name, enum_member.type)))
return '\n'.join(indented_lines)
def _generate_struct_for_enum_type(self, enum_name, enum_type):
@@ -275,7 +275,7 @@
def _generate_builder_state_enum(self, type_declaration):
lines = []
- required_members = filter(lambda member: not member.is_optional, type_declaration.type_members)
+ required_members = [member for member in type_declaration.type_members if not member.is_optional]
enum_values = []
lines.append(' enum {')
@@ -343,7 +343,7 @@
for domain in self.domains_to_generate():
type_declarations = self.type_declarations_for_domain(domain)
- declarations_to_generate = filter(lambda decl: self.type_needs_shape_assertions(decl.type), type_declarations)
+ declarations_to_generate = [decl for decl in type_declarations if self.type_needs_shape_assertions(decl.type)]
for type_declaration in declarations_to_generate:
for type_member in type_declaration.type_members:
@@ -394,8 +394,8 @@
for domain in self.domains_to_generate():
type_declarations = self.type_declarations_for_domain(domain)
declaration_types = [decl.type for decl in type_declarations]
- object_types = filter(lambda _type: isinstance(_type, ObjectType), declaration_types)
- enum_types = filter(lambda _type: isinstance(_type, EnumType), declaration_types)
+ object_types = [_type for _type in declaration_types if isinstance(_type, ObjectType)]
+ enum_types = [_type for _type in declaration_types if isinstance(_type, EnumType)]
if len(object_types) + len(enum_types) == 0:
continue
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py 2018-02-19 04:47:53.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py 2018-03-03 10:29:27.494364075 -0600
@@ -30,10 +30,10 @@
from string import Template
from operator import methodcaller
-from cpp_generator import CppGenerator
-from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
-from generator import Generator, ucfirst
-from models import AliasedType, ArrayType, EnumType, ObjectType
+from .cpp_generator import CppGenerator
+from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from .generator import Generator, ucfirst
+from .models import AliasedType, ArrayType, EnumType, ObjectType
log = logging.getLogger('global')
@@ -65,8 +65,8 @@
sections.append('namespace Protocol {')
sections.extend(self._generate_enum_mapping_and_conversion_methods(domains))
sections.append(self._generate_open_field_names())
- builder_sections = map(self._generate_builders_for_domain, domains)
- sections.extend(filter(lambda section: len(section) > 0, builder_sections))
+ builder_sections = list(map(self._generate_builders_for_domain, domains))
+ sections.extend([section for section in builder_sections if len(section) > 0])
sections.append('} // namespace Protocol')
sections.append(Template(CppTemplates.ImplementationPostlude).substitute(None, **header_args))
@@ -128,8 +128,8 @@
type_declarations = self.type_declarations_for_domain(domain)
declaration_types = [decl.type for decl in type_declarations]
- object_types = filter(lambda _type: isinstance(_type, ObjectType), declaration_types)
- enum_types = filter(lambda _type: isinstance(_type, EnumType), declaration_types)
+ object_types = [_type for _type in declaration_types if isinstance(_type, ObjectType)]
+ enum_types = [_type for _type in declaration_types if isinstance(_type, EnumType)]
if len(object_types) + len(enum_types) == 0:
return ''
@@ -156,8 +156,8 @@
sections = []
sections.append('namespace %s {' % self.helpers_namespace())
sections.extend(self._generate_enum_mapping())
- enum_parser_sections = map(self._generate_enum_conversion_methods_for_domain, domains)
- sections.extend(filter(lambda section: len(section) > 0, enum_parser_sections))
+ enum_parser_sections = list(map(self._generate_enum_conversion_methods_for_domain, domains))
+ sections.extend([section for section in enum_parser_sections if len(section) > 0])
if len(sections) == 1:
return [] # No declarations to emit, just the namespace.
@@ -168,7 +168,7 @@
lines = []
for domain in self.domains_to_generate():
type_declarations = self.type_declarations_for_domain(domain)
- for type_declaration in filter(lambda decl: Generator.type_has_open_fields(decl.type), type_declarations):
+ for type_declaration in [decl for decl in type_declarations if Generator.type_has_open_fields(decl.type)]:
open_members = Generator.open_fields(type_declaration)
for type_member in sorted(open_members, key=lambda member: member.member_name):
field_name = '::'.join(['Inspector', 'Protocol', domain.domain_name, ucfirst(type_declaration.type_name), ucfirst(type_member.member_name)])
@@ -179,7 +179,7 @@
def _generate_builders_for_domain(self, domain):
sections = []
type_declarations = self.type_declarations_for_domain(domain)
- declarations_to_generate = filter(lambda decl: self.type_needs_shape_assertions(decl.type), type_declarations)
+ declarations_to_generate = [decl for decl in type_declarations if self.type_needs_shape_assertions(decl.type)]
for type_declaration in declarations_to_generate:
for type_member in type_declaration.type_members:
@@ -200,8 +200,8 @@
return Template(CppTemplates.ProtocolObjectRuntimeCast).substitute(None, **args)
def _generate_assertion_for_object_declaration(self, object_declaration):
- required_members = filter(lambda member: not member.is_optional, object_declaration.type_members)
- optional_members = filter(lambda member: member.is_optional, object_declaration.type_members)
+ required_members = [member for member in object_declaration.type_members if not member.is_optional]
+ optional_members = [member for member in object_declaration.type_members if member.is_optional]
should_count_properties = not Generator.type_has_open_fields(object_declaration.type)
lines = []
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py 2018-03-03 10:29:27.534364244 -0600
@@ -30,9 +30,9 @@
import string
from string import Template
-from generator import Generator, ucfirst
-from generator_templates import GeneratorTemplates as Templates
-from models import EnumType
+from .generator import Generator, ucfirst
+from .generator_templates import GeneratorTemplates as Templates
+from .models import EnumType
log = logging.getLogger('global')
@@ -46,16 +46,16 @@
def should_generate_domain(self, domain):
type_declarations = self.type_declarations_for_domain(domain)
- domain_enum_types = filter(lambda declaration: isinstance(declaration.type, EnumType), type_declarations)
+ domain_enum_types = [declaration for declaration in type_declarations if isinstance(declaration.type, EnumType)]
return len(self.commands_for_domain(domain)) > 0 or len(self.events_for_domain(domain)) > 0 or len(domain_enum_types) > 0
def domains_to_generate(self):
- return filter(self.should_generate_domain, Generator.domains_to_generate(self))
+ return list(filter(self.should_generate_domain, Generator.domains_to_generate(self)))
def generate_output(self):
sections = []
sections.append(self.generate_license())
- sections.extend(map(self.generate_domain, self.domains_to_generate()))
+ sections.extend(list(map(self.generate_domain, self.domains_to_generate())))
return "\n\n".join(sections)
def generate_domain(self, domain):
@@ -70,7 +70,7 @@
commands = self.commands_for_domain(domain)
events = self.events_for_domain(domain)
- has_async_commands = any(map(lambda command: command.is_async, commands))
+ has_async_commands = any([command.is_async for command in commands])
if len(events) > 0 or has_async_commands:
lines.append('InspectorBackend.register%(domain)sDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "%(domain)s");' % args)
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py 2018-02-19 04:47:53.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py 2018-03-03 10:29:27.574364412 -0600
@@ -30,11 +30,11 @@
import re
from string import Template
-from cpp_generator import CppGenerator
-from generator import Generator
-from models import Frameworks
-from objc_generator import ObjCGenerator
-from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+from .cpp_generator import CppGenerator
+from .generator import Generator
+from .models import Frameworks
+from .objc_generator import ObjCGenerator
+from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
log = logging.getLogger('global')
@@ -47,7 +47,7 @@
return '%sBackendDispatchers.h' % self.protocol_name()
def domains_to_generate(self):
- return filter(self.should_generate_commands_for_domain, Generator.domains_to_generate(self))
+ return list(filter(self.should_generate_commands_for_domain, Generator.domains_to_generate(self)))
def generate_output(self):
headers = [
@@ -64,7 +64,7 @@
sections = []
sections.append(self.generate_license())
sections.append(Template(ObjCTemplates.BackendDispatcherHeaderPrelude).substitute(None, **header_args))
- sections.extend(map(self._generate_objc_handler_declarations_for_domain, domains))
+ sections.extend(list(map(self._generate_objc_handler_declarations_for_domain, domains)))
sections.append(Template(ObjCTemplates.BackendDispatcherHeaderPostlude).substitute(None, **header_args))
return '\n\n'.join(sections)
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py 2018-03-03 10:29:27.650364732 -0600
@@ -30,11 +30,11 @@
import re
from string import Template
-from cpp_generator import CppGenerator
-from generator import Generator
-from models import PrimitiveType, EnumType, AliasedType, Frameworks
-from objc_generator import ObjCTypeCategory, ObjCGenerator, join_type_and_name
-from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+from .cpp_generator import CppGenerator
+from .generator import Generator
+from .models import PrimitiveType, EnumType, AliasedType, Frameworks
+from .objc_generator import ObjCTypeCategory, ObjCGenerator, join_type_and_name
+from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
log = logging.getLogger('global')
@@ -47,7 +47,7 @@
return '%sBackendDispatchers.mm' % self.protocol_name()
def domains_to_generate(self):
- return filter(self.should_generate_commands_for_domain, Generator.domains_to_generate(self))
+ return list(filter(self.should_generate_commands_for_domain, Generator.domains_to_generate(self)))
def generate_output(self):
secondary_headers = [
@@ -65,7 +65,7 @@
sections = []
sections.append(self.generate_license())
sections.append(Template(ObjCTemplates.BackendDispatcherImplementationPrelude).substitute(None, **header_args))
- sections.extend(map(self._generate_handler_implementation_for_domain, domains))
+ sections.extend(list(map(self._generate_handler_implementation_for_domain, domains)))
sections.append(Template(ObjCTemplates.BackendDispatcherImplementationPostlude).substitute(None, **header_args))
return '\n\n'.join(sections)
@@ -114,7 +114,7 @@
if command.return_parameters:
lines.append(' Ref<JSON::Object> resultObject = JSON::Object::create();')
- required_pointer_parameters = filter(lambda parameter: not parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type), command.return_parameters)
+ required_pointer_parameters = [parameter for parameter in command.return_parameters if not parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type)]
for parameter in required_pointer_parameters:
var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name)
lines.append(' THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(%s, @"%s");' % (var_name, var_name))
@@ -122,7 +122,7 @@
if objc_array_class and objc_array_class.startswith(self.objc_prefix()):
lines.append(' THROW_EXCEPTION_FOR_BAD_TYPE_IN_ARRAY(%s, [%s class]);' % (var_name, objc_array_class))
- optional_pointer_parameters = filter(lambda parameter: parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type), command.return_parameters)
+ optional_pointer_parameters = [parameter for parameter in command.return_parameters if parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type)]
for parameter in optional_pointer_parameters:
var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name)
lines.append(' THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(%s, @"%s");' % (var_name, var_name))
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_header.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_header.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_header.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_header.py 2018-03-03 10:29:27.674364834 -0600
@@ -29,9 +29,9 @@
import string
from string import Template
-from generator import Generator
-from objc_generator import ObjCGenerator
-from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+from .generator import Generator
+from .objc_generator import ObjCGenerator
+from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
log = logging.getLogger('global')
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_implementation.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_implementation.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_implementation.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_implementation.py 2018-03-03 10:29:27.714365002 -0600
@@ -29,9 +29,9 @@
import string
from string import Template
-from generator import Generator
-from objc_generator import ObjCGenerator
-from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+from .generator import Generator
+from .objc_generator import ObjCGenerator
+from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
log = logging.getLogger('global')
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py 2018-03-03 10:29:27.766365221 -0600
@@ -29,10 +29,10 @@
import string
from string import Template
-from cpp_generator import CppGenerator
-from generator import Generator, ucfirst
-from objc_generator import ObjCGenerator
-from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+from .cpp_generator import CppGenerator
+from .generator import Generator, ucfirst
+from .objc_generator import ObjCGenerator
+from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
log = logging.getLogger('global')
@@ -45,7 +45,7 @@
return '%sEventDispatchers.mm' % self.protocol_name()
def domains_to_generate(self):
- return filter(self.should_generate_events_for_domain, Generator.domains_to_generate(self))
+ return list(filter(self.should_generate_events_for_domain, Generator.domains_to_generate(self)))
def generate_output(self):
secondary_headers = [
@@ -62,7 +62,7 @@
sections = []
sections.append(self.generate_license())
sections.append(Template(ObjCTemplates.ImplementationPrelude).substitute(None, **header_args))
- sections.extend(map(self._generate_event_dispatcher_implementations, domains))
+ sections.extend(list(map(self._generate_event_dispatcher_implementations, domains)))
sections.append(Template(ObjCTemplates.ImplementationPostlude).substitute(None, **header_args))
return '\n\n'.join(sections)
@@ -100,7 +100,7 @@
lines.append(' const FrontendRouter& router = _controller->frontendRouter();')
lines.append('')
- required_pointer_parameters = filter(lambda parameter: not parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type), event.event_parameters)
+ required_pointer_parameters = [parameter for parameter in event.event_parameters if not parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type)]
for parameter in required_pointer_parameters:
var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name)
lines.append(' THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(%s, @"%s");' % (var_name, var_name))
@@ -108,7 +108,7 @@
if objc_array_class and objc_array_class.startswith(self.objc_prefix()):
lines.append(' THROW_EXCEPTION_FOR_BAD_TYPE_IN_ARRAY(%s, [%s class]);' % (var_name, objc_array_class))
- optional_pointer_parameters = filter(lambda parameter: parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type), event.event_parameters)
+ optional_pointer_parameters = [parameter for parameter in event.event_parameters if parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type)]
for parameter in optional_pointer_parameters:
var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name)
lines.append(' THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(%s, @"%s");' % (var_name, var_name))
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py 2018-03-03 10:29:27.850365575 -0600
@@ -29,10 +29,10 @@
import string
from string import Template
-from generator import Generator, ucfirst
-from models import ObjectType, EnumType, Platforms
-from objc_generator import ObjCGenerator, join_type_and_name
-from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+from .generator import Generator, ucfirst
+from .models import ObjectType, EnumType, Platforms
+from .objc_generator import ObjCGenerator, join_type_and_name
+from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
log = logging.getLogger('global')
@@ -60,9 +60,9 @@
}
domains = self.domains_to_generate()
- type_domains = filter(self.should_generate_types_for_domain, domains)
- command_domains = filter(self.should_generate_commands_for_domain, domains)
- event_domains = filter(self.should_generate_events_for_domain, domains)
+ type_domains = list(filter(self.should_generate_types_for_domain, domains))
+ command_domains = list(filter(self.should_generate_commands_for_domain, domains))
+ event_domains = list(filter(self.should_generate_events_for_domain, domains))
# FIXME: <https://webkit.org/b/138222> Web Inspector: Reduce unnecessary enums/types generated in ObjC Protocol Interfaces
# Currently we generate enums/types for all types in the type_domains. For the built-in
@@ -72,14 +72,14 @@
sections = []
sections.append(self.generate_license())
sections.append(Template(ObjCTemplates.HeaderPrelude).substitute(None, **header_args))
- sections.append('\n'.join(filter(None, map(self._generate_forward_declarations, type_domains))))
+ sections.append('\n'.join([_f for _f in map(self._generate_forward_declarations, type_domains) if _f]))
sections.append(self._generate_enum_for_platforms())
- sections.append('\n'.join(filter(None, map(self._generate_enums, type_domains))))
- sections.append('\n'.join(filter(None, map(self._generate_types, type_domains))))
+ sections.append('\n'.join([_f for _f in map(self._generate_enums, type_domains) if _f]))
+ sections.append('\n'.join([_f for _f in map(self._generate_types, type_domains) if _f]))
if self.get_generator_setting('generate_backend', False):
- sections.append('\n\n'.join(filter(None, map(self._generate_command_protocols, command_domains))))
- sections.append('\n\n'.join(filter(None, map(self._generate_event_interfaces, event_domains))))
+ sections.append('\n\n'.join([_f for _f in map(self._generate_command_protocols, command_domains) if _f]))
+ sections.append('\n\n'.join([_f for _f in map(self._generate_event_interfaces, event_domains) if _f]))
sections.append(Template(ObjCTemplates.HeaderPostlude).substitute(None))
return '\n\n'.join(sections)
@@ -171,8 +171,8 @@
lines.append('- (instancetype)initWithPayload:(NSDictionary<NSString *, id> *)payload;')
lines.append('- (instancetype)initWithProtocolObject:(RWIProtocolJSONObject *)jsonObject;')
- required_members = filter(lambda member: not member.is_optional, declaration.type_members)
- optional_members = filter(lambda member: member.is_optional, declaration.type_members)
+ required_members = [member for member in declaration.type_members if not member.is_optional]
+ optional_members = [member for member in declaration.type_members if member.is_optional]
if required_members:
lines.append(self._generate_init_method_for_required_members(domain, declaration, required_members))
for member in required_members:
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_internal_header.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_internal_header.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_internal_header.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_internal_header.py 2018-03-03 10:29:27.870365659 -0600
@@ -29,9 +29,9 @@
import string
from string import Template
-from generator import Generator, ucfirst
-from objc_generator import ObjCGenerator
-from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+from .generator import Generator, ucfirst
+from .objc_generator import ObjCGenerator
+from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
log = logging.getLogger('global')
@@ -55,12 +55,12 @@
'includes': '\n'.join(['#import ' + header for header in sorted(headers)]),
}
- event_domains = filter(self.should_generate_events_for_domain, self.domains_to_generate())
+ event_domains = list(filter(self.should_generate_events_for_domain, self.domains_to_generate()))
sections = []
sections.append(self.generate_license())
sections.append(Template(ObjCTemplates.GenericHeaderPrelude).substitute(None, **header_args))
- sections.append('\n\n'.join(filter(None, map(self._generate_event_dispatcher_private_interfaces, event_domains))))
+ sections.append('\n\n'.join([_f for _f in map(self._generate_event_dispatcher_private_interfaces, event_domains) if _f]))
sections.append(Template(ObjCTemplates.GenericHeaderPostlude).substitute(None, **header_args))
return '\n\n'.join(sections)
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py 2018-03-03 10:29:27.930365912 -0600
@@ -29,10 +29,10 @@
import string
from string import Template
-from generator import Generator
-from models import EnumType, Frameworks, Platforms
-from objc_generator import ObjCGenerator
-from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+from .generator import Generator
+from .models import EnumType, Frameworks, Platforms
+from .objc_generator import ObjCGenerator
+from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
log = logging.getLogger('global')
@@ -51,7 +51,7 @@
return '%sTypeConversions.h' % self.protocol_name()
def domains_to_generate(self):
- return filter(self.should_generate_types_for_domain, Generator.domains_to_generate(self))
+ return list(filter(self.should_generate_types_for_domain, Generator.domains_to_generate(self)))
def generate_output(self):
headers = [
@@ -70,7 +70,7 @@
sections.append(Template(ObjCTemplates.TypeConversionsHeaderPrelude).substitute(None, **header_args))
sections.append(Template(ObjCTemplates.TypeConversionsHeaderStandard).substitute(None))
sections.append(self._generate_enum_conversion_for_platforms())
- sections.extend(map(self._generate_enum_conversion_functions, domains))
+ sections.extend(list(map(self._generate_enum_conversion_functions, domains)))
sections.append(Template(ObjCTemplates.TypeConversionsHeaderPostlude).substitute(None, **header_args))
return '\n\n'.join(sections)
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_implementation.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_implementation.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_implementation.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_implementation.py 2018-03-03 10:29:27.974366097 -0600
@@ -28,10 +28,10 @@
import string
from string import Template
-from generator import Generator
-from models import EnumType, ObjectType, ArrayType, AliasedType, PrimitiveType, Frameworks
-from objc_generator import ObjCGenerator
-from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+from .generator import Generator
+from .models import EnumType, ObjectType, ArrayType, AliasedType, PrimitiveType, Frameworks
+from .objc_generator import ObjCGenerator
+from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
log = logging.getLogger('global')
@@ -50,7 +50,7 @@
return '%sTypeConversions.mm' % self.protocol_name()
def domains_to_generate(self):
- return filter(self.should_generate_types_for_domain, Generator.domains_to_generate(self))
+ return list(filter(self.should_generate_types_for_domain, Generator.domains_to_generate(self)))
def generate_output(self):
secondary_headers = [
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py 2018-03-03 10:29:28.046366401 -0600
@@ -29,10 +29,10 @@
import string
from string import Template
-from generator import Generator, ucfirst
-from models import ObjectType, EnumType, Frameworks
-from objc_generator import ObjCTypeCategory, ObjCGenerator
-from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+from .generator import Generator, ucfirst
+from .models import ObjectType, EnumType, Frameworks
+from .objc_generator import ObjCTypeCategory, ObjCGenerator
+from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
log = logging.getLogger('global')
@@ -51,7 +51,7 @@
return '%sTypes.mm' % self.protocol_name()
def domains_to_generate(self):
- return filter(self.should_generate_types_for_domain, Generator.domains_to_generate(self))
+ return list(filter(self.should_generate_types_for_domain, Generator.domains_to_generate(self)))
def generate_output(self):
secondary_headers = [
@@ -75,7 +75,7 @@
sections = []
sections.append(self.generate_license())
sections.append(Template(ObjCTemplates.ImplementationPrelude).substitute(None, **header_args))
- sections.extend(map(self.generate_type_implementations, domains))
+ sections.extend(list(map(self.generate_type_implementations, domains)))
sections.append(Template(ObjCTemplates.ImplementationPostlude).substitute(None, **header_args))
return '\n\n'.join(sections)
@@ -95,7 +95,7 @@
lines.append('')
lines.append(self._generate_init_method_for_payload(domain, declaration))
lines.append(self._generate_init_method_for_protocol_object(domain, declaration))
- required_members = filter(lambda member: not member.is_optional, declaration.type_members)
+ required_members = [member for member in declaration.type_members if not member.is_optional]
if required_members:
lines.append('')
lines.append(self._generate_init_method_for_required_members(domain, declaration, required_members))
@@ -167,7 +167,7 @@
lines.append(' return nil;')
lines.append('')
- required_pointer_members = filter(lambda member: ObjCGenerator.is_type_objc_pointer_type(member.type), required_members)
+ required_pointer_members = [member for member in required_members if ObjCGenerator.is_type_objc_pointer_type(member.type)]
if required_pointer_members:
for member in required_pointer_members:
var_name = ObjCGenerator.identifier_to_objc_identifier(member.member_name)
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generator.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generator.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/generator.py 2018-02-19 04:47:53.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/generator.py 2018-03-03 10:29:28.178366957 -0600
@@ -29,8 +29,8 @@
import re
from string import Template
-from generator_templates import GeneratorTemplates as Templates
-from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks, Platforms
+from .generator_templates import GeneratorTemplates as Templates
+from .models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks, Platforms
log = logging.getLogger('global')
@@ -140,7 +140,7 @@
# These methods are overridden by subclasses.
def non_supplemental_domains(self):
- return filter(lambda domain: not domain.is_supplemental, self.model().domains)
+ return [domain for domain in self.model().domains if not domain.is_supplemental]
def domains_to_generate(self):
return self.non_supplemental_domains()
@@ -176,7 +176,7 @@
fields = set(_TYPES_WITH_OPEN_FIELDS.get(type_declaration.type.qualified_name(), []))
if not fields:
return type_declaration.type_members
- return filter(lambda member: member.member_name in fields, type_declaration.type_members)
+ return [member for member in type_declaration.type_members if member.member_name in fields]
def type_needs_shape_assertions(self, _type):
if not hasattr(self, "_types_needing_shape_assertions"):
@@ -189,7 +189,7 @@
# set of types will not be automatically regenerated on subsequent calls to
# Generator.types_needing_shape_assertions().
def calculate_types_requiring_shape_assertions(self, domains):
- domain_names = map(lambda domain: domain.domain_name, domains)
+ domain_names = [domain.domain_name for domain in domains]
log.debug("> Calculating types that need shape assertions (eligible domains: %s)" % ", ".join(domain_names))
# Mutates the passed-in set; this simplifies checks to prevent infinite recursion.
@@ -245,7 +245,7 @@
for _type in all_types:
if not isinstance(_type, EnumType):
continue
- map(self._assign_encoding_for_enum_value, _type.enum_values())
+ list(map(self._assign_encoding_for_enum_value, _type.enum_values()))
def _assign_encoding_for_enum_value(self, enum_value):
if enum_value in self._enum_value_encodings:
@@ -279,7 +279,7 @@
return _ALWAYS_SPECIALCASED_ENUM_VALUE_LOOKUP_TABLE[match.group(1).upper()]
# Split on hyphen, introduce camelcase, and force uppercasing of acronyms.
- subwords = map(ucfirst, _ENUM_IDENTIFIER_RENAME_MAP.get(enum_value, enum_value).split('-'))
+ subwords = list(map(ucfirst, _ENUM_IDENTIFIER_RENAME_MAP.get(enum_value, enum_value).split('-')))
return re.sub(re.compile(regex, re.IGNORECASE), replaceCallback, "".join(subwords))
@staticmethod
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py 2018-03-03 10:27:16.885813621 -0600
@@ -1,25 +1,25 @@
# Required for Python to search this directory for module files
-from models import *
-from generator import *
-from cpp_generator import *
-from objc_generator import *
+from .models import *
+from .generator import *
+from .cpp_generator import *
+from .objc_generator import *
-from generate_cpp_alternate_backend_dispatcher_header import *
-from generate_cpp_backend_dispatcher_header import *
-from generate_cpp_backend_dispatcher_implementation import *
-from generate_cpp_frontend_dispatcher_header import *
-from generate_cpp_frontend_dispatcher_implementation import *
-from generate_cpp_protocol_types_header import *
-from generate_cpp_protocol_types_implementation import *
-from generate_js_backend_commands import *
-from generate_objc_backend_dispatcher_header import *
-from generate_objc_backend_dispatcher_implementation import *
-from generate_objc_configuration_header import *
-from generate_objc_configuration_implementation import *
-from generate_objc_frontend_dispatcher_implementation import *
-from generate_objc_header import *
-from generate_objc_internal_header import *
-from generate_objc_protocol_types_implementation import *
-from generate_objc_protocol_type_conversions_header import *
-from generate_objc_protocol_type_conversions_implementation import *
+from .generate_cpp_alternate_backend_dispatcher_header import *
+from .generate_cpp_backend_dispatcher_header import *
+from .generate_cpp_backend_dispatcher_implementation import *
+from .generate_cpp_frontend_dispatcher_header import *
+from .generate_cpp_frontend_dispatcher_implementation import *
+from .generate_cpp_protocol_types_header import *
+from .generate_cpp_protocol_types_implementation import *
+from .generate_js_backend_commands import *
+from .generate_objc_backend_dispatcher_header import *
+from .generate_objc_backend_dispatcher_implementation import *
+from .generate_objc_configuration_header import *
+from .generate_objc_configuration_implementation import *
+from .generate_objc_frontend_dispatcher_implementation import *
+from .generate_objc_header import *
+from .generate_objc_internal_header import *
+from .generate_objc_protocol_types_implementation import *
+from .generate_objc_protocol_type_conversions_header import *
+from .generate_objc_protocol_type_conversions_implementation import *
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/models.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/models.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/models.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/models.py 2018-03-03 10:29:28.370367765 -0600
@@ -35,7 +35,7 @@
def find_duplicates(l):
- return [key for key, count in collections.Counter(l).items() if count > 1]
+ return [key for key, count in list(collections.Counter(l).items()) if count > 1]
_FRAMEWORK_CONFIG_MAP = {
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator.py webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator.py 2018-02-19 01:45:15.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator.py 2018-03-03 10:29:28.534368456 -0600
@@ -24,8 +24,8 @@
# THE POSSIBILITY OF SUCH DAMAGE.
import logging
-from generator import Generator, ucfirst
-from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks
+from .generator import Generator, ucfirst
+from .models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks
log = logging.getLogger('global')
@@ -50,7 +50,7 @@
'id': 'identifier', # Page.Frame.id, Runtime.ExecutionContextDescription.id, Debugger.BreakpointAction.id
}
-_OBJC_IDENTIFIER_REVERSE_RENAME_MAP = dict((v, k) for k, v in _OBJC_IDENTIFIER_RENAME_MAP.iteritems())
+_OBJC_IDENTIFIER_REVERSE_RENAME_MAP = dict((v, k) for k, v in _OBJC_IDENTIFIER_RENAME_MAP.items())
class ObjCTypeCategory:
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_header.py webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_header.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_header.py 2018-02-19 01:45:14.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_header.py 2018-03-03 10:31:53.878980553 -0600
@@ -158,7 +158,7 @@
lines = []
lines.append("#define %(macroPrefix)s_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(macro) \\" % args)
- functions = filter(lambda function: function.is_global_private, self.model().all_functions())
+ functions = [function for function in self.model().all_functions() if function.is_global_private]
functions.sort(key=lambda x: x.function_name)
for function in functions:
function_args = {
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/builtins/builtins_generate_internals_wrapper_header.py webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/builtins/builtins_generate_internals_wrapper_header.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/builtins/builtins_generate_internals_wrapper_header.py 2018-02-19 01:45:14.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/builtins/builtins_generate_internals_wrapper_header.py 2018-03-03 10:31:53.878980553 -0600
@@ -36,7 +36,7 @@
class BuiltinsInternalsWrapperHeaderGenerator(BuiltinsGenerator):
def __init__(self, model):
BuiltinsGenerator.__init__(self, model)
- self.internals = filter(lambda object: 'internal' in object.annotations, model.objects)
+ self.internals = [object for object in model.objects if 'internal' in object.annotations]
def output_filename(self):
return "%sJSBuiltinInternals.h" % self.model().framework.setting('namespace')
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/builtins/builtins_generate_internals_wrapper_implementation.py webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/builtins/builtins_generate_internals_wrapper_implementation.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/builtins/builtins_generate_internals_wrapper_implementation.py 2018-02-19 01:45:14.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/builtins/builtins_generate_internals_wrapper_implementation.py 2018-03-03 10:31:53.878980553 -0600
@@ -36,7 +36,7 @@
class BuiltinsInternalsWrapperImplementationGenerator(BuiltinsGenerator):
def __init__(self, model):
BuiltinsGenerator.__init__(self, model)
- self.internals = filter(lambda object: 'internal' in object.annotations, model.objects)
+ self.internals = [object for object in model.objects if 'internal' in object.annotations]
def output_filename(self):
return "%sJSBuiltinInternals.cpp" % self.model().framework.setting('namespace')
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/builtins/builtins_model.py webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/builtins/builtins_model.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/builtins/builtins_model.py 2018-02-19 01:45:14.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/builtins/builtins_model.py 2018-03-03 10:31:53.878980553 -0600
@@ -26,6 +26,7 @@
import logging
import re
import os
+import sys
from builtins_templates import BuiltinsGeneratorTemplates as Templates
@@ -155,6 +156,8 @@
return interface
+ def __lt__(a,b):
+ return a.function_name < b.function_name
class BuiltinsCollection:
def __init__(self, framework_name):
@@ -210,7 +213,7 @@
result = []
- for owner, years in owner_to_years.items():
+ for owner, years in list(owner_to_years.items()):
sorted_years = list(years)
sorted_years.sort()
result.append("%s %s" % (', '.join(sorted_years), owner))
@@ -303,4 +306,4 @@
functionBounds.append((start, end))
functionStrings = [text[start:end].strip() for (start, end) in functionBounds]
- return map(BuiltinFunction.fromString, functionStrings)
+ return list(map(BuiltinFunction.fromString, functionStrings))
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/cssmin.py webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/cssmin.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/cssmin.py 2018-02-19 01:45:14.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/cssmin.py 2018-03-06 10:13:10.065229770 -0600
@@ -46,4 +46,7 @@
if sys.version_info[0] == 3 and sys.stdin.encoding != 'UTF-8':
import io
sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='UTF-8')
+ if sys.version_info[0] == 3 and sys.stdout.encoding != 'UTF-8':
+ import io
+ sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='UTF-8')
sys.stdout.write(cssminify(sys.stdin.read()))
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/generate-js-builtins.py webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/generate-js-builtins.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/generate-js-builtins.py 2018-02-19 01:45:14.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/generate-js-builtins.py 2018-03-03 10:31:03.854769938 -0600
@@ -31,20 +31,33 @@
import logging
import optparse
import os
+import sys
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.ERROR)
log = logging.getLogger('global')
from lazywriter import LazyFileWriter
-from builtins import *
-
+from builtins_model import *
+from builtins_generate_combined_header import *
+from builtins_generate_combined_implementation import *
+from builtins_generate_separate_header import *
+from builtins_generate_separate_implementation import *
+from builtins_generate_wrapper_header import *
+from builtins_generate_wrapper_implementation import *
+from builtins_generate_internals_wrapper_header import *
+from builtins_generate_internals_wrapper_implementation import *
def concatenated_output_filename(builtins_files, framework_name, generate_only_wrapper_files):
if generate_only_wrapper_files:
return framework_name + 'JSBuiltins.h-result'
return os.path.basename(builtins_files[0]) + '-result'
+def doopen(file, mode):
+ if sys.version_info.major == 2:
+ return open(file, mode)
+ else:
+ return open(file, mode, encoding="UTF-8")
def generate_bindings_for_builtins_files(builtins_files=[],
output_path=None,
@@ -59,7 +72,7 @@
model = BuiltinsCollection(framework_name=framework_name)
for filepath in builtins_files:
- with open(filepath, "r") as file:
+ with doopen(filepath, "r") as file:
file_text = file.read()
file_name = os.path.basename(filepath)
@@ -146,7 +159,7 @@
for filepath in os.listdir(arg_options.input_directory):
input_filepaths.append(os.path.join(arg_options.input_directory, filepath))
- input_filepaths = sorted(filter(lambda name: fnmatch.fnmatch(name, '*.js'), input_filepaths))
+ input_filepaths = sorted([name for name in input_filepaths if fnmatch.fnmatch(name, '*.js')])
options = {
'output_path': arg_options.output_directory,
@@ -159,7 +172,7 @@
log.debug("Generating code for builtins.")
log.debug("Parsed options:")
- for option, value in options.items():
+ for option, value in list(options.items()):
log.debug(" %s: %s" % (option, value))
log.debug("")
log.debug("Input files:")
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/generateYarrUnicodePropertyTables.py webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/generateYarrUnicodePropertyTables.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/generateYarrUnicodePropertyTables.py 2018-02-19 01:45:14.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/generateYarrUnicodePropertyTables.py 2018-03-05 10:40:12.417625895 -0600
@@ -90,7 +90,10 @@
def openOrExit(path, mode):
try:
- return open(path, mode)
+ if sys.version_info.major == 2 or mode == "wb" or mode == "rb":
+ return open(path, mode)
+ else:
+ return open(path, mode, encoding = "UTF-8")
except IOError as e:
print("I/O error opening {0}, ({1}): {2}".format(path, e.errno, e.strerror))
exit(1)
@@ -214,6 +217,12 @@
return ""
return self.aliasToScript[name]
+def dowrite(file, str):
+ if sys.version_info.major == 2:
+ file.write(str)
+ else:
+ file.write(bytes(str, "utf-8"))
+
class PropertyData:
allPropertyData = []
@@ -322,7 +331,7 @@
insertLocation = None
lowCodePoint = None
highCodePoint = None
- for idx in xrange(len(matches)):
+ for idx in range(len(matches)):
match = matches[idx]
if codePoint == match + 1:
lowCodePoint = match
@@ -351,22 +360,22 @@
lowCodePoint = codePoint
highCodePoint = codePoint
- for idx in xrange(len(ranges)):
- range = ranges[idx]
- if lowCodePoint >= range[0] and highCodePoint <= range[1]:
+ for idx in range(len(ranges)):
+ cur_range = ranges[idx]
+ if lowCodePoint >= cur_range[0] and highCodePoint <= cur_range[1]:
return
- if lowCodePoint <= (range[1] + 1) and highCodePoint >= (range[0] - 1):
+ if lowCodePoint <= (cur_range[1] + 1) and highCodePoint >= (cur_range[0] - 1):
while idx < len(ranges) and highCodePoint >= (ranges[idx][0] - 1):
- range = ranges[idx]
- lowCodePoint = min(lowCodePoint, range[0])
- highCodePoint = max(highCodePoint, range[1])
+ cur_range = ranges[idx]
+ lowCodePoint = min(lowCodePoint, cur_range[0])
+ highCodePoint = max(highCodePoint, cur_range[1])
del ranges[idx]
- self.codePointCount = self.codePointCount - (range[1] - range[0]) - 1
+ self.codePointCount = self.codePointCount - (cur_range[1] - cur_range[0]) - 1
ranges.insert(idx, (lowCodePoint, highCodePoint))
self.codePointCount = self.codePointCount + (highCodePoint - lowCodePoint) + 1
return
- elif highCodePoint < range[0]:
+ elif highCodePoint < cur_range[0]:
if lowCodePoint != highCodePoint:
ranges.insert(idx, (lowCodePoint, highCodePoint))
self.codePointCount = self.codePointCount + (highCodePoint - lowCodePoint) + 1
@@ -384,7 +393,7 @@
def addRangeUnorderedForMatchesAndRanges(self, lowCodePoint, highCodePoint, matches, ranges):
if len(matches) and highCodePoint >= matches[0] and lowCodePoint <= matches[-1]:
- for idx in xrange(len(matches)):
+ for idx in range(len(matches)):
match = matches[idx]
if lowCodePoint <= match and highCodePoint >= match:
while idx < len(matches) and highCodePoint >= matches[idx]:
@@ -414,22 +423,22 @@
elif highCodePoint < match:
break
- for idx in xrange(len(ranges)):
- range = ranges[idx]
- if lowCodePoint >= range[0] and highCodePoint <= range[1]:
+ for idx in range(len(ranges)):
+ cur_range = ranges[idx]
+ if lowCodePoint >= cur_range[0] and highCodePoint <= cur_range[1]:
return
- if lowCodePoint <= (range[1] + 1) and highCodePoint >= (range[0] - 1):
+ if lowCodePoint <= (cur_range[1] + 1) and highCodePoint >= (cur_range[0] - 1):
while idx < len(ranges) and highCodePoint >= (ranges[idx][0] - 1):
- range = ranges[idx]
- lowCodePoint = min(lowCodePoint, range[0])
- highCodePoint = max(highCodePoint, range[1])
+ cur_range = ranges[idx]
+ lowCodePoint = min(lowCodePoint, cur_range[0])
+ highCodePoint = max(highCodePoint, cur_range[1])
del ranges[idx]
- self.codePointCount = self.codePointCount - (range[1] - range[0]) - 1
+ self.codePointCount = self.codePointCount - (cur_range[1] - cur_range[0]) - 1
ranges.insert(idx, (lowCodePoint, highCodePoint))
self.codePointCount = self.codePointCount + (highCodePoint - lowCodePoint) + 1
return
- elif highCodePoint < range[0]:
+ elif highCodePoint < cur_range[0]:
ranges.insert(idx, (lowCodePoint, highCodePoint))
self.codePointCount = self.codePointCount + (highCodePoint - lowCodePoint) + 1
return
@@ -459,13 +468,13 @@
self.addRangeUnorderedForMatchesAndRanges(firstUnicodeCodePoint, highCodePoint, self.unicodeMatches, self.unicodeRanges)
def removeMatchFromRanges(self, codePoint, ranges):
- for idx in xrange(len(ranges)):
- range = ranges[idx]
- if range[0] <= codePoint and codePoint <= range[1]:
+ for idx in range(len(ranges)):
+ cur_range = ranges[idx]
+ if cur_range[0] <= codePoint and codePoint <= cur_range[1]:
ranges.pop(idx)
- if range[0] < codePoint and codePoint < range[1]:
- lowRange = (range[0], codePoint - 1)
- highRange = (codePoint + 1, range[1])
+ if cur_range[0] < codePoint and codePoint < cur_range[1]:
+ lowRange = (cur_range[0], codePoint - 1)
+ highRange = (codePoint + 1, cur_range[1])
# Since list.insert inserts before the index given, handle the high range first
if highRange[0] == highRange[1]:
self.addMatchUnordered(highRange[0])
@@ -476,14 +485,14 @@
else:
ranges.insert(idx, lowRange)
else:
- if range[0] == codePoint:
- range = (codePoint + 1, range[1])
+ if cur_range[0] == codePoint:
+ cur_range = (codePoint + 1, cur_range[1])
else:
- range = (range[0], codePoint - 1)
- if range[0] == range[1]:
- self.addMatchUnordered(range[0])
+ cur_range = (cur_range[0], codePoint - 1)
+ if cur_range[0] == cur_range[1]:
+ self.addMatchUnordered(cur_range[0])
else:
- ranges.insert(idx, range)
+ ranges.insert(idx, cur_range)
self.codePointCount = self.codePointCount - 1
return
@@ -505,59 +514,59 @@
valuesThisLine = 0
firstValue = True
- file.write("{")
+ dowrite(file, "{")
for elem in dataList:
if firstValue:
firstValue = False
else:
- file.write(", ")
+ dowrite(file, ", ")
valuesThisLine = valuesThisLine + 1
if valuesThisLine > valuesPerLine:
- file.write("\n ")
+ dowrite(file, "\n ")
valuesThisLine = 1
formatter(file, elem)
- file.write("}")
+ dowrite(file, "}")
def dump(self, file, commaAfter):
- file.write("static std::unique_ptr<CharacterClass> {}()\n{{\n".format(self.getCreateFuncName()))
- file.write(" // Name = {}, number of codePoints: {}\n".format(self.name, self.codePointCount))
- file.write(" auto characterClass = std::make_unique<CharacterClass>(\n")
- file.write(" std::initializer_list<UChar32>(")
- self.dumpMatchData(file, 8, self.matches, lambda file, match: (file.write("{0:0=#4x}".format(match))))
- file.write("),\n")
- file.write(" std::initializer_list<CharacterRange>(")
- self.dumpMatchData(file, 4, self.ranges, lambda file, range: (file.write("{{{0:0=#4x}, {1:0=#4x}}}".format(range[0], range[1]))))
- file.write("),\n")
- file.write(" std::initializer_list<UChar32>(")
- self.dumpMatchData(file, 8, self.unicodeMatches, lambda file, match: (file.write("{0:0=#6x}".format(match))))
- file.write("),\n")
- file.write(" std::initializer_list<CharacterRange>(")
- self.dumpMatchData(file, 4, self.unicodeRanges, lambda file, range: (file.write("{{{0:0=#6x}, {1:0=#6x}}}".format(range[0], range[1]))))
- file.write("));\n")
+ dowrite(file, "static std::unique_ptr<CharacterClass> {}()\n{{\n".format(self.getCreateFuncName()))
+ dowrite(file, " // Name = {}, number of codePoints: {}\n".format(self.name, self.codePointCount))
+ dowrite(file, " auto characterClass = std::make_unique<CharacterClass>(\n")
+ dowrite(file, " std::initializer_list<UChar32>(")
+ self.dumpMatchData(file, 8, self.matches, lambda file, match: (dowrite(file, "{0:0=#4x}".format(match))))
+ dowrite(file, "),\n")
+ dowrite(file, " std::initializer_list<CharacterRange>(")
+ self.dumpMatchData(file, 4, self.ranges, lambda file, range: (dowrite(file, "{{{0:0=#4x}, {1:0=#4x}}}".format(range[0], range[1]))))
+ dowrite(file, "),\n")
+ dowrite(file, " std::initializer_list<UChar32>(")
+ self.dumpMatchData(file, 8, self.unicodeMatches, lambda file, match: (dowrite(file, "{0:0=#6x}".format(match))))
+ dowrite(file, "),\n")
+ dowrite(file, " std::initializer_list<CharacterRange>(")
+ self.dumpMatchData(file, 4, self.unicodeRanges, lambda file, range: (dowrite(file, "{{{0:0=#6x}, {1:0=#6x}}}".format(range[0], range[1]))))
+ dowrite(file, "));\n")
- file.write(" characterClass->m_hasNonBMPCharacters = {};\n".format(("false", "true")[self.hasNonBMPCharacters]))
- file.write(" return characterClass;\n}\n\n")
+ dowrite(file, " characterClass->m_hasNonBMPCharacters = {};\n".format(("false", "true")[self.hasNonBMPCharacters]))
+ dowrite(file, " return characterClass;\n}\n\n")
@classmethod
def dumpAll(cls, file):
for propertyData in cls.allPropertyData:
propertyData.dump(file, propertyData != cls.allPropertyData[-1])
- file.write("typedef std::unique_ptr<CharacterClass> (*CreateCharacterClass)();\n")
- file.write("static CreateCharacterClass createFunctions[{}] = {{\n ".format(len(cls.allPropertyData)))
+ dowrite(file, "typedef std::unique_ptr<CharacterClass> (*CreateCharacterClass)();\n")
+ dowrite(file, "static CreateCharacterClass createFunctions[{}] = {{\n ".format(len(cls.allPropertyData)))
functionsOnThisLine = 0
for propertyData in cls.allPropertyData:
- file.write(" {},".format(propertyData.getCreateFuncName()))
+ dowrite(file, " {},".format(propertyData.getCreateFuncName()))
functionsOnThisLine = functionsOnThisLine + 1
if functionsOnThisLine == 4:
- file.write("\n ")
+ dowrite(file, "\n ")
functionsOnThisLine = 0
- file.write("};\n\n")
+ dowrite(file, "};\n\n")
@classmethod
def createAndDumpHashTable(self, file, propertyDict, tablePrefix):
- propertyKeys = propertyDict.keys()
+ propertyKeys = list(propertyDict.keys())
numberOfKeys = len(propertyKeys)
hashSize = ceilingToPowerOf2(numberOfKeys * 2)
hashMask = hashSize - 1
@@ -587,7 +596,7 @@
hashTable[hash] = (len(valueTable), None)
valueTable.append((key, keyValue[1]))
- file.write("static const struct HashIndex {}TableIndex[{}] = {{\n".format(tablePrefix, len(hashTable)))
+ dowrite(file, "static const struct HashIndex {}TableIndex[{}] = {{\n".format(tablePrefix, len(hashTable)))
for tableIndex in hashTable:
value = -1
@@ -597,17 +606,17 @@
if tableIndex[1] is not None:
next = tableIndex[1]
- file.write(" {{ {}, {} }},\n".format(value, next))
+ dowrite(file, " {{ {}, {} }},\n".format(value, next))
- file.write("};\n\n")
+ dowrite(file, "};\n\n")
- file.write("static const struct HashValue {}TableValue[{}] = {{\n".format(tablePrefix, len(valueTable)))
+ dowrite(file, "static const struct HashValue {}TableValue[{}] = {{\n".format(tablePrefix, len(valueTable)))
for value in valueTable:
- file.write(" {{ \"{}\", {} }},\n".format(value[0], value[1]))
- file.write("};\n\n")
+ dowrite(file, " {{ \"{}\", {} }},\n".format(value[0], value[1]))
+ dowrite(file, "};\n\n")
- file.write("static const struct HashTable {}HashTable = \n".format(tablePrefix))
- file.write(" {{ {}, {}, {}TableValue, {}TableIndex }};\n\n".format(len(valueTable), hashMask, tablePrefix, tablePrefix))
+ dowrite(file, "static const struct HashTable {}HashTable = \n".format(tablePrefix))
+ dowrite(file, " {{ {}, {}, {}TableValue, {}TableIndex }};\n\n".format(len(valueTable), hashMask, tablePrefix, tablePrefix))
class Scripts:
@@ -742,21 +751,21 @@
lowCodePoint = int(codePoints[:dotDot], 16)
highCodePoint = int(codePoints[dotDot + 2:], 16)
currentPropertyData.addRange(lowCodePoint, highCodePoint)
- for codePoint in xrange(lowCodePoint, highCodePoint + 1):
+ for codePoint in range(lowCodePoint, highCodePoint + 1):
commonScriptExtenstionPropertyData.removeMatch(codePoint)
inheritedScriptExtensionPropertyData.removeMatch(codePoint)
# For the scripts that don't have any additional extension codePoints, copy the script
# data to the script extension with the same name
- for scriptName, propertyData in self.scriptsByName.iteritems():
+ for scriptName, propertyData in self.scriptsByName.items():
if scriptName not in self.scriptExtensionsByName:
self.scriptExtensionsByName[scriptName] = propertyData
def dump(self, file):
- file.write("// Scripts:\n")
+ dowrite(file, "// Scripts:\n")
PropertyData.createAndDumpHashTable(file, self.scriptsByName, "script")
- file.write("// Script_Extensions:\n")
+ dowrite(file, "// Script_Extensions:\n")
PropertyData.createAndDumpHashTable(file, self.scriptExtensionsByName, "scriptExtension")
@@ -877,7 +886,7 @@
propertyDatas[1].addRange(self.lastAddedCodePoint + 1, MaxUnicode)
def dump(self, file):
- file.write("// General_Category:\n")
+ dowrite(file, "// General_Category:\n")
PropertyData.createAndDumpHashTable(file, self.propertyDataByCategory, "generalCategory")
@@ -920,7 +929,7 @@
currentPropertyData.addRange(int(codePoints[:dotDot], 16), int(codePoints[dotDot + 2:], 16))
def dump(self, file):
- file.write("// binary properties:\n")
+ dowrite(file, "// binary properties:\n")
PropertyData.createAndDumpHashTable(file, self.propertyDataByProperty, "binaryProperty")
if __name__ == "__main__":
@@ -950,7 +959,7 @@
propertyDataHFile = openOrExit(unicodeProertyDataHPath, "wb")
- propertyDataHFile.write(header)
+ dowrite(propertyDataHFile, header)
aliases.parsePropertyAliasesFile(propertyAliasesFile)
aliases.parsePropertyValueAliasesFile(propertyValueAliasesFile)
@@ -974,6 +983,6 @@
binaryProperty.dump(propertyDataHFile)
scripts.dump(propertyDataHFile)
- propertyDataHFile.write(footer)
+ dowrite(propertyDataHFile, footer)
exit(0)
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/hasher.py webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/hasher.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/hasher.py 2018-02-19 01:45:14.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/hasher.py 2018-03-03 10:24:55.761218389 -0600
@@ -36,7 +36,7 @@
hash = stringHashingStartValue
strLength = len(str)
- characterPairs = strLength / 2
+ characterPairs = int(strLength / 2)
remainder = strLength & 1
# Main loop
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/jsmin.py webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/jsmin.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/jsmin.py 2018-02-19 01:45:14.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/jsmin.py 2018-03-03 11:31:35.142780467 -0600
@@ -79,10 +79,13 @@
def write(char):
# all of this is to support literal regular expressions.
# sigh
- if char in 'return':
+ if str(char) in 'return':
self.return_buf += char
self.is_return = self.return_buf == 'return'
- self.outs.write(char)
+ if sys.version_info.major == 2:
+ self.outs.write(char)
+ else:
+ self.outs.write(str(char))
if self.is_return:
self.return_buf = ''
@@ -118,8 +121,8 @@
write(previous)
elif not previous:
return
- elif previous >= '!':
- if previous in "'\"":
+ elif str(previous) >= "!":
+ if str(previous) in "'\"":
in_quote = previous
write(previous)
previous_non_space = previous
@@ -166,7 +169,7 @@
if numslashes % 2 == 0:
in_quote = ''
write(''.join(quote_buf))
- elif next1 in '\r\n':
+ elif str(next1) in '\r\n':
if previous_non_space in newlineend_strings \
or previous_non_space > '~':
while 1:
@@ -179,7 +182,7 @@
or next2 > '~' or next2 == '/':
do_newline = True
break
- elif next1 < '!' and not in_re:
+ elif str(next1) < '!' and not in_re:
if (previous_non_space in space_strings \
or previous_non_space > '~') \
and (next2 in space_strings or next2 > '~'):
@@ -217,14 +220,14 @@
do_newline = False
write(next1)
- if not in_re and next1 in "'\"`":
+ if not in_re and str(next1) in "'\"`":
in_quote = next1
quote_buf = []
previous = next1
next1 = next2
- if previous >= '!':
+ if str(previous) >= '!':
previous_non_space = previous
if previous == '\\':
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/make-js-file-arrays.py webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/make-js-file-arrays.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/Scripts/make-js-file-arrays.py 2018-02-19 01:45:14.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/Scripts/make-js-file-arrays.py 2018-03-03 14:39:11.326990464 -0600
@@ -25,7 +25,11 @@
import io
import os
from optparse import OptionParser
-from StringIO import StringIO
+import sys
+if sys.version_info.major == 2:
+ from StringIO import StringIO
+else:
+ from io import StringIO
from jsmin import JavascriptMinify
@@ -37,7 +41,7 @@
def chunk(list, chunkSize):
- for i in xrange(0, len(list), chunkSize):
+ for i in range(0, len(list), chunkSize):
yield list[i:i + chunkSize]
@@ -85,7 +89,7 @@
print('extern const char {0:s}JavaScript[{1:d}];'.format(variableName, size), file=headerFile)
print('const char {0:s}JavaScript[{1:d}] = {{'.format(variableName, size), file=sourceFile)
- codepoints = map(ord, characters)
+ codepoints = list(map(ord, characters))
for codepointChunk in chunk(codepoints, 16):
print(' {0:s},'.format(','.join(map(stringifyCodepoint, codepointChunk))), file=sourceFile)
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/wasm/generateWasm.py webkitgtk-2.19.91/Source/JavaScriptCore/wasm/generateWasm.py
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/wasm/generateWasm.py 2018-02-19 01:45:17.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/wasm/generateWasm.py 2018-03-02 16:27:21.193406681 -0600
@@ -71,7 +71,7 @@
# We need to do this because python is dumb and won't let me use self in the lambda, which is ridiculous.
if ret == None:
ret = lambda op: {"name": op, "opcode": self.opcodes[op]}
- for op in self.opcodes.iterkeys():
+ for op in self.opcodes.keys():
if filter(self.opcodes[op]):
yield ret(op)
diff -ur webkitgtk-2.19.91.orig/Source/JavaScriptCore/yarr/generateYarrCanonicalizeUnicode webkitgtk-2.19.91/Source/JavaScriptCore/yarr/generateYarrCanonicalizeUnicode
--- webkitgtk-2.19.91.orig/Source/JavaScriptCore/yarr/generateYarrCanonicalizeUnicode 2018-02-19 01:45:17.000000000 -0600
+++ webkitgtk-2.19.91/Source/JavaScriptCore/yarr/generateYarrCanonicalizeUnicode 2018-03-03 10:35:11.555812290 -0600
@@ -31,7 +31,6 @@
import os
import re
import sys
-from sets import Set
header = """/*
* Copyright (C) 2016 Apple Inc. All rights reserved.
@@ -78,11 +77,21 @@
dirname = os.path.dirname(path)
if not os.path.isdir(dirname):
os.makedirs(dirname)
- return open(path, mode)
+ if sys.version_info.major == 2 or mode == "wb" or mode == "rb":
+ return open(path, mode)
+ else:
+ return open(path, mode, encoding = "UTF-8")
except IOError as e:
- print "I/O error opening {0}, ({1}): {2}".format(path, e.errno, e.strerror)
+ print("I/O error opening {0}, ({1}): {2}".format(path, e.errno, e.strerror))
exit(1)
+def dowrite(file, str):
+ if sys.version_info.major == 2:
+ file.write(str)
+ else:
+ file.write(bytes(str, "utf-8"))
+
+
class Canonicalize:
def __init__(self):
self.canonicalGroups = {};
@@ -93,7 +102,7 @@
self.canonicalGroups[mapping].append(code)
def readCaseFolding(self, file):
- codesSeen = Set()
+ codesSeen = set()
for line in file:
line = line.split('#', 1)[0]
line = line.rstrip()
@@ -157,26 +166,26 @@
set = characterSets[i]
for ch in set:
characters = characters + "0x{character:04x}, ".format(character=ch)
- file.write("const UChar32 unicodeCharacterSet{index:d}[] = {{ {characters}0 }};\n".format(index=i, characters=characters))
+ dowrite(file, "const UChar32 unicodeCharacterSet{index:d}[] = {{ {characters}0 }};\n".format(index=i, characters=characters))
- file.write("\n")
- file.write("static const size_t UNICODE_CANONICALIZATION_SETS = {setCount:d};\n".format(setCount=len(characterSets)))
- file.write("const UChar32* const unicodeCharacterSetInfo[UNICODE_CANONICALIZATION_SETS] = {\n")
+ dowrite(file, "\n")
+ dowrite(file, "static const size_t UNICODE_CANONICALIZATION_SETS = {setCount:d};\n".format(setCount=len(characterSets)))
+ dowrite(file, "const UChar32* const unicodeCharacterSetInfo[UNICODE_CANONICALIZATION_SETS] = {\n")
for i in range(len(characterSets)):
- file.write(" unicodeCharacterSet{setNumber:d},\n".format(setNumber=i))
+ dowrite(file, " unicodeCharacterSet{setNumber:d},\n".format(setNumber=i))
- file.write("};\n")
- file.write("\n")
- file.write("const size_t UNICODE_CANONICALIZATION_RANGES = {rangeCount:d};\n".format(rangeCount=len(rangeInfo)))
- file.write("const CanonicalizationRange unicodeRangeInfo[UNICODE_CANONICALIZATION_RANGES] = {\n")
+ dowrite(file, "};\n")
+ dowrite(file, "\n")
+ dowrite(file, "const size_t UNICODE_CANONICALIZATION_RANGES = {rangeCount:d};\n".format(rangeCount=len(rangeInfo)))
+ dowrite(file, "const CanonicalizationRange unicodeRangeInfo[UNICODE_CANONICALIZATION_RANGES] = {\n")
for info in rangeInfo:
typeAndValue = info["type"].split(":")
- file.write(" {{ 0x{begin:04x}, 0x{end:04x}, 0x{value:04x}, {type} }},\n".format(begin=info["begin"], end=info["end"], value=int(typeAndValue[1]), type=typeAndValue[0]))
+ dowrite(file, " {{ 0x{begin:04x}, 0x{end:04x}, 0x{value:04x}, {type} }},\n".format(begin=info["begin"], end=info["end"], value=int(typeAndValue[1]), type=typeAndValue[0]))
- file.write("};\n")
- file.write("\n")
+ dowrite(file, "};\n")
+ dowrite(file, "\n")
if __name__ == "__main__":
@@ -194,9 +203,9 @@
canonicalize = Canonicalize()
canonicalize.readCaseFolding(caseFoldingTxtFile)
- canonicalizeHFile.write(header);
+ dowrite(canonicalizeHFile, header)
canonicalize.createTables(canonicalizeHFile)
- canonicalizeHFile.write(footer);
+ dowrite(canonicalizeHFile, footer)
caseFoldingTxtFile.close()
canonicalizeHFile.close()
diff -ur webkitgtk-2.19.91.orig/Source/WebCore/platform/network/create-http-header-name-table webkitgtk-2.19.91/Source/WebCore/platform/network/create-http-header-name-table
--- webkitgtk-2.19.91.orig/Source/WebCore/platform/network/create-http-header-name-table 2018-02-19 01:45:32.000000000 -0600
+++ webkitgtk-2.19.91/Source/WebCore/platform/network/create-http-header-name-table 2018-03-03 11:28:42.253809307 -0600
@@ -41,7 +41,7 @@
http_header_name_to_id = { }
http_header_names = []
-for line in input_file.xreadlines():
+for line in input_file:
http_header_name = line.strip()
if not http_header_name or http_header_name[:2] == '//':
continue
diff -ur webkitgtk-2.19.91.orig/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl webkitgtk-2.19.91/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl
--- webkitgtk-2.19.91.orig/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl 2018-02-19 01:45:32.000000000 -0600
+++ webkitgtk-2.19.91/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl 2018-03-05 16:17:47.582174114 -0600
@@ -163,6 +163,8 @@
my $threejsLicense = readLicenseFile(File::Spec->catfile($threejsPath, 'LICENSE'));
make_path($protocolDir, $targetResourcePath);
+$python = $ENV{"PYTHON"} if defined($ENV{"PYTHON"});
+
# Copy over dynamically loaded files from other frameworks, even if we aren't combining resources.
copy(File::Spec->catfile($ENV{'JAVASCRIPTCORE_PRIVATE_HEADERS_DIR'}, 'InspectorBackendCommands.js'), File::Spec->catfile($protocolDir, 'InspectorBackendCommands.js')) or die "Copy of InspectorBackendCommands.js failed: $!";