From 63003d5bcedc637facc67f2e6811f630eb36787e Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 11 Jun 2018 18:02:29 +0200 Subject: [PATCH] Correctly extract platform from the dependency. If the `dep` is a two char string (as "qt"), the `platform, name = dep` will split the string and search for 't' dependency in 'q' platform. So, we have to be sure that the dep is a tuple before splitting it. --- kiwixbuild/_global.py | 4 ++-- kiwixbuild/builder.py | 4 ++-- kiwixbuild/platforms/base.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kiwixbuild/_global.py b/kiwixbuild/_global.py index f513eda..8efafee 100644 --- a/kiwixbuild/_global.py +++ b/kiwixbuild/_global.py @@ -22,9 +22,9 @@ def add_target_step(key, what): _target_steps[key] = what def get_target_step(key, default_context=None): - try: + if isinstance(key, tuple): context, target = key - except ValueError: + else: context, target = default_context, key return _target_steps[(context, target)] diff --git a/kiwixbuild/builder.py b/kiwixbuild/builder.py index 4ee7dd5..9113078 100644 --- a/kiwixbuild/builder.py +++ b/kiwixbuild/builder.py @@ -68,9 +68,9 @@ class Builder: targetPlatform = PlatformInfo.get_platform(targetPlatformName) for dep in target.get_dependencies(targetPlatform, True): - try: + if isinstance(dep, tuple): depPlatform, depName = dep - except ValueError: + else: depPlatform, depName = targetPlatformName, dep if (depPlatform, depName) in targets: yield from self.order_dependencies((depPlatform, depName), targets) diff --git a/kiwixbuild/platforms/base.py b/kiwixbuild/platforms/base.py index 71edc13..4252195 100644 --- a/kiwixbuild/platforms/base.py +++ b/kiwixbuild/platforms/base.py @@ -57,9 +57,9 @@ class PlatformInfo(metaclass=_MetaPlatform): targets[('source', targetName)] = targetClass.Source targets[(self.name, targetName)] = targetClass.Builder for dep in targetClass.Builder.get_dependencies(self, False): - try: + if isinstance(dep, tuple): depPlatformName, depName = dep - except ValueError: + else: depPlatformName, depName = self.name, dep depPlatform = self.get_platform(depPlatformName, targets) depPlatform.add_targets(depName, targets)