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.
This commit is contained in:
Matthieu Gautier 2018-06-11 18:02:29 +02:00
parent fc61fbab3d
commit 63003d5bce
3 changed files with 6 additions and 6 deletions

View File

@ -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)]

View File

@ -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)

View File

@ -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)