Config - fix - use basetring to check if a target is string

pull/2175/head
0xc0170 2016-07-13 14:59:48 +01:00
parent 359d33cc16
commit 9c3801b7b5
2 changed files with 4 additions and 4 deletions

View File

@ -88,7 +88,7 @@ def get_config(src_path, target, toolchain_name):
config = Config(target, src_paths) config = Config(target, src_paths)
# If the 'target' argument is a string, convert it to a target instance # If the 'target' argument is a string, convert it to a target instance
if isinstance(target, str): if isinstance(target, basestring):
try: try:
target = TARGET_MAP[target] target = TARGET_MAP[target]
except KeyError: except KeyError:
@ -149,7 +149,7 @@ def build_project(src_path, build_path, target, toolchain_name,
config = config or Config(target, src_paths) config = config or Config(target, src_paths)
# If the 'target' argument is a string, convert it to a target instance # If the 'target' argument is a string, convert it to a target instance
if isinstance(target, str): if isinstance(target, basestring):
try: try:
target = TARGET_MAP[target] target = TARGET_MAP[target]
except KeyError: except KeyError:
@ -286,7 +286,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
config = Config(target, src_paths) config = Config(target, src_paths)
# If the 'target' argument is a string, convert it to a target instance # If the 'target' argument is a string, convert it to a target instance
if isinstance(target, str): if isinstance(target, basestring):
try: try:
target = TARGET_MAP[target] target = TARGET_MAP[target]
except KeyError: except KeyError:

View File

@ -182,7 +182,7 @@ class Config:
self.lib_config_data = {} self.lib_config_data = {}
# Make sure that each config is processed only once # Make sure that each config is processed only once
self.processed_configs = {} self.processed_configs = {}
self.target = target if isinstance(target, str) else target.name self.target = target if isinstance(target, basestring) else target.name
self.target_labels = Target.get_target(self.target).get_labels() self.target_labels = Target.get_target(self.target).get_labels()
self.added_features = set() self.added_features = set()
self.removed_features = set() self.removed_features = set()