From eca458d01ae4cabb3f12bf5869e2cc3f46ecdb13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Tue, 3 Sep 2019 09:46:55 +0200 Subject: [PATCH 1/2] tools: fix GYP ninja generator for Python 3 --- tools/gyp/pylib/gyp/generator/ninja.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/gyp/pylib/gyp/generator/ninja.py b/tools/gyp/pylib/gyp/generator/ninja.py index 7d1d3b7b30b5f1..141ae3de9c503e 100644 --- a/tools/gyp/pylib/gyp/generator/ninja.py +++ b/tools/gyp/pylib/gyp/generator/ninja.py @@ -352,7 +352,7 @@ def WriteCollapsedDependencies(self, name, targets, order_only=None): Uses a stamp file if necessary.""" - assert targets == filter(None, targets), targets + assert targets == list(filter(None, targets)), targets if len(targets) == 0: assert not order_only return None @@ -429,8 +429,8 @@ def WriteSpec(self, spec, config_name, generator_flags): compile_depends.append(target.PreCompileInput()) if target.uses_cpp: self.target.uses_cpp = True - actions_depends = filter(None, actions_depends) - compile_depends = filter(None, compile_depends) + actions_depends = list(filter(None, actions_depends)) + compile_depends = list(filter(None, compile_depends)) actions_depends = self.WriteCollapsedDependencies('actions_depends', actions_depends) compile_depends = self.WriteCollapsedDependencies('compile_depends', @@ -2378,6 +2378,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, qualified_target_for_hash = gyp.common.QualifiedTarget(build_file, name, toolset) + qualified_target_for_hash = qualified_target_for_hash.encode('utf-8') hash_for_rules = hashlib.md5(qualified_target_for_hash).hexdigest() base_path = os.path.dirname(build_file) From 3b2ed104b75514db303dccee14a585ec8461348e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Tue, 3 Sep 2019 10:39:20 +0200 Subject: [PATCH 2/2] fixup! tools: fix GYP ninja generator for Python 3 --- tools/gyp/pylib/gyp/generator/ninja.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/gyp/pylib/gyp/generator/ninja.py b/tools/gyp/pylib/gyp/generator/ninja.py index 141ae3de9c503e..115b6f6637faa4 100644 --- a/tools/gyp/pylib/gyp/generator/ninja.py +++ b/tools/gyp/pylib/gyp/generator/ninja.py @@ -352,7 +352,7 @@ def WriteCollapsedDependencies(self, name, targets, order_only=None): Uses a stamp file if necessary.""" - assert targets == list(filter(None, targets)), targets + assert targets == [item for item in targets if item], targets if len(targets) == 0: assert not order_only return None @@ -429,8 +429,8 @@ def WriteSpec(self, spec, config_name, generator_flags): compile_depends.append(target.PreCompileInput()) if target.uses_cpp: self.target.uses_cpp = True - actions_depends = list(filter(None, actions_depends)) - compile_depends = list(filter(None, compile_depends)) + actions_depends = [item for item in actions_depends if item] + compile_depends = [item for item in compile_depends if item] actions_depends = self.WriteCollapsedDependencies('actions_depends', actions_depends) compile_depends = self.WriteCollapsedDependencies('compile_depends',