diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/build')
11 files changed, 31 insertions, 25 deletions
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py b/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py index 1799cd5a153..5f43ffabc26 100755 --- a/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py +++ b/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py @@ -71,7 +71,7 @@ class Expansion(object): def enabled_longhands(self): include = lambda longhand: not longhand[ 'runtime_flag'] or self.is_enabled(longhand['runtime_flag']) - return filter(include, self._longhands) + return list(filter(include, self._longhands)) @property def index(self): @@ -87,8 +87,9 @@ class Expansion(object): def create_expansions(longhands): flags = collect_runtime_flags(longhands) - expansions = map(lambda mask: Expansion(longhands, flags, mask), - range(1 << len(flags))) + expansions = list( + map(lambda mask: Expansion(longhands, flags, mask), + range(1 << len(flags)))) assert len(expansions) > 0 # We generate 2^N expansions for N flags, so enforce some limit. assert len(flags) <= 4, 'Too many runtime flags for a single shorthand' @@ -114,14 +115,14 @@ class StylePropertyShorthandWriter(json5_generator.Writer): self._longhand_dictionary = defaultdict(list) for property_ in json5_properties.shorthands: - property_['longhand_enum_keys'] = map(enum_key_for_css_property, - property_['longhands']) - property_['longhand_property_ids'] = map(id_for_css_property, - property_['longhands']) - - longhands = map( - lambda name: json5_properties.properties_by_name[name], - property_['longhands']) + property_['longhand_enum_keys'] = list( + map(enum_key_for_css_property, property_['longhands'])) + property_['longhand_property_ids'] = list( + map(id_for_css_property, property_['longhands'])) + + longhands = list( + map(lambda name: json5_properties.properties_by_name[name], + property_['longhands'])) property_['expansions'] = create_expansions(longhands) for longhand_enum_key in property_['longhand_enum_keys']: self._longhand_dictionary[longhand_enum_key].append(property_) diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py index 75030ac577e..f72aadee17d 100755 --- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py +++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py @@ -42,8 +42,8 @@ class CSSPropertyInstancesWriter(json5_generator.Writer): aliases = self._css_properties.aliases # Lists of PropertyClassData. - self._property_classes_by_id = map(self.get_class, properties) - self._alias_classes_by_id = map(self.get_class, aliases) + self._property_classes_by_id = list(map(self.get_class, properties)) + self._alias_classes_by_id = list(map(self.get_class, aliases)) # Sort by enum value. self._property_classes_by_id.sort(key=lambda t: t.enum_value) diff --git a/chromium/third_party/blink/renderer/build/scripts/gperf.py b/chromium/third_party/blink/renderer/build/scripts/gperf.py index 5ee49056be4..db72660d471 100644 --- a/chromium/third_party/blink/renderer/build/scripts/gperf.py +++ b/chromium/third_party/blink/renderer/build/scripts/gperf.py @@ -95,7 +95,7 @@ def main(): open(args.output_file, 'wb').write( generate_gperf(gperf_path, - open(infile).read(), gperf_args)) + open(infile).read(), gperf_args).encode('utf-8')) if __name__ == '__main__': diff --git a/chromium/third_party/blink/renderer/build/scripts/in_file.py b/chromium/third_party/blink/renderer/build/scripts/in_file.py index 28adc050f1e..58113483e57 100644 --- a/chromium/third_party/blink/renderer/build/scripts/in_file.py +++ b/chromium/third_party/blink/renderer/build/scripts/in_file.py @@ -66,7 +66,7 @@ class InFile(object): self._defaults = defaults self._valid_values = copy.deepcopy( valid_values if valid_values else {}) - self._parse(map(str.strip, lines)) + self._parse(list(map(str.strip, lines))) @classmethod def load_from_files(self, file_paths, defaults, valid_values, diff --git a/chromium/third_party/blink/renderer/build/scripts/in_generator.py b/chromium/third_party/blink/renderer/build/scripts/in_generator.py index e46740a2e85..ab1981ad1e3 100644 --- a/chromium/third_party/blink/renderer/build/scripts/in_generator.py +++ b/chromium/third_party/blink/renderer/build/scripts/in_generator.py @@ -32,10 +32,15 @@ import os import os.path import shlex import shutil +import sys import optparse from in_file import InFile +# TODO: Remove this once Python2 is obsoleted. +if sys.version_info.major != 2: + basestring = str + ######################################################### # This is now deprecated - use json5_generator.py instead diff --git a/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py b/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py index cafe8d94a8e..6925a4fa580 100755 --- a/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py +++ b/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py @@ -138,7 +138,7 @@ class RuntimeFeatureWriter(BaseRuntimeFeatureWriter): except Exception: # If trouble unpickling, overwrite pass - with open(os.path.abspath(file_name), 'w') as pickle_file: + with open(os.path.abspath(file_name), 'wb') as pickle_file: pickle.dump(features_map, pickle_file) def _template_inputs(self): diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl index dc3f44c5b10..3eefcf9f0ee 100644 --- a/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl @@ -26,7 +26,7 @@ using {{namespace}}FunctionMap = HashMap<AtomicString, {{namespace}}ConstructorF static {{namespace}}FunctionMap* g_{{namespace|lower}}_constructors = nullptr; -{% for tag in tags|sort if not tag.noConstructor %} +{% for tag in tags|sort(attribute='name') if not tag.noConstructor %} static {{namespace}}Element* {{namespace}}{{tag.name.to_upper_camel_case()}}Constructor( Document& document, const CreateElementFlags flags) { {% if tag.runtimeEnabled %} @@ -52,7 +52,7 @@ static void Create{{namespace}}FunctionMap() { // Empty array initializer lists are illegal [dcl.init.aggr] and will not // compile in MSVC. If tags list is empty, add check to skip this. static const Create{{namespace}}FunctionMapData data[] = { - {% for tag in tags|sort if not tag.noConstructor %} + {% for tag in tags|sort(attribute='name') if not tag.noConstructor %} { {{cpp_namespace}}::{{tag|symbol}}Tag, {{namespace}}{{tag.name.to_upper_camel_case()}}Constructor }, {% endfor %} }; diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl index 9bfc489e048..5f86184e879 100644 --- a/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl @@ -22,7 +22,7 @@ HTMLTypeMap CreateHTMLTypeMap() { const char* name; HTMLElementType type; } kTags[] = { - {% for tag in tags|sort %} + {% for tag in tags|sort(attribute='name') %} { "{{tag.name}}", HTMLElementType::k{{tag.js_interface}} }, {% endfor %} }; @@ -42,7 +42,7 @@ HTMLElementType htmlElementTypeForTag(const AtomicString& tagName, const Documen if (it == html_type_map.end()) return HTMLElementType::kHTMLUnknownElement; - {% for tag in tags|sort %} + {% for tag in tags|sort(attribute='name') %} {% if tag.runtimeEnabled %} if (tagName == "{{tag.name}}") { if (!RuntimeEnabledFeatures::{{tag.runtimeEnabled}}Enabled(document->GetExecutionContext())) { diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl index 1b5297d52dc..edecc81d9d4 100644 --- a/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl @@ -15,7 +15,7 @@ namespace blink { class Document; // Type checking. -{% for tag in tags|sort if not tag.multipleTagNames and not tag.noTypeHelpers %} +{% for tag in tags|sort(attribute='name') if not tag.multipleTagNames and not tag.noTypeHelpers %} class {{tag.interface}}; template <> inline bool IsElementOfType<const {{tag.interface}}>(const Node& node) { diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl index 0244433af2e..dcdbb02a56c 100644 --- a/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl @@ -25,7 +25,7 @@ {% macro trie_leaf(index, object, return_macro, lowercase_data) %} -{% set name, value = object.items()[0] %} +{% set name, value = (object.items()|list)[0] %} {% if name|length %} if ( {%- for c in name -%} @@ -45,7 +45,7 @@ return {{ return_macro(value) }}; {% macro trie_switch(trie, index, return_macro, lowercase_data) %} -{% if trie|length == 1 and trie.values()[0] is string %} +{% if trie|length == 1 and (trie.values()|list)[0] is string %} {{ trie_leaf(index, trie, return_macro, lowercase_data) -}} {% else %} {% if lowercase_data %} diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl index cb05c6c4315..bd5566b03e7 100644 --- a/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl @@ -24,12 +24,12 @@ namespace {{cpp_namespace}} { {{symbol_export}}extern const WTF::AtomicString& {{namespace_prefix}}NamespaceURI; // Tags -{% for tag in tags|sort %} +{% for tag in tags|sort(attribute='name') %} {{symbol_export}}extern const blink::{{namespace}}QualifiedName& {{tag|symbol}}Tag; {% endfor %} // Attributes -{% for attr in attrs|sort %} +{% for attr in attrs|sort(attribute='name') %} {{symbol_export}}extern const blink::QualifiedName& {{attr|symbol}}Attr; {% endfor %} |