From 3a7d9eed873fdd12e38ffc586014206354f6336b Mon Sep 17 00:00:00 2001 From: Aaron Boman Date: Mon, 6 Oct 2014 12:31:22 -0500 Subject: [PATCH 1/9] Use feature name for better error output. --- src/build/feature.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build/feature.py b/src/build/feature.py index 2ab6e5c67..386e49931 100644 --- a/src/build/feature.py +++ b/src/build/feature.py @@ -442,7 +442,7 @@ def validate_value_string (f, value_string): # An empty value is allowed for optional features if not values[0] in f.values() and \ (values[0] or not f.optional()): - raise InvalidValue ("'%s' is not a known value of feature '%s'\nlegal values: '%s'" % (values [0], feature, f.values())) + raise InvalidValue ("'%s' is not a known value of feature '%s'\nlegal values: '%s'" % (values [0], f.name(), f.values())) for v in values [1:]: # this will validate any subfeature values in value-string From 3655ad21a3787011e7dd04701b9ac741e24ce040 Mon Sep 17 00:00:00 2001 From: Aaron Boman Date: Mon, 6 Oct 2014 12:32:04 -0500 Subject: [PATCH 2/9] Remove return in favor of try...except return. --- src/build/project.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/build/project.py b/src/build/project.py index 414aecceb..9e43fb185 100644 --- a/src/build/project.py +++ b/src/build/project.py @@ -529,7 +529,6 @@ actual value %s""" % (jamfile_module, saved_project, self.current_project)) def attribute(self, project, attribute): """Returns the value of the specified attribute in the specified jamfile module.""" - return self.module2attributes[project].get(attribute) try: return self.module2attributes[project].get(attribute) except: From 4554c315856d2557c4bf646cb875ec29e288a98c Mon Sep 17 00:00:00 2001 From: Aaron Boman Date: Mon, 6 Oct 2014 12:32:33 -0500 Subject: [PATCH 3/9] Remove unused import --- src/build/property_set.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build/property_set.py b/src/build/property_set.py index 4fff814c9..6b3643045 100644 --- a/src/build/property_set.py +++ b/src/build/property_set.py @@ -9,7 +9,7 @@ import hashlib from b2.util.utility import * -import property, feature, string +import property, feature import b2.build.feature from b2.exceptions import * from b2.util.sequence import unique From 7c7a99850a1abd1c702b663d788bf47db2fd043c Mon Sep 17 00:00:00 2001 From: Aaron Boman Date: Mon, 6 Oct 2014 12:33:59 -0500 Subject: [PATCH 4/9] Fix pathing issue. ARM's ar.exe didn't like the mis-matched path separators. --- src/build/virtual_target.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build/virtual_target.py b/src/build/virtual_target.py index f3d190f64..ac6703056 100644 --- a/src/build/virtual_target.py +++ b/src/build/virtual_target.py @@ -708,7 +708,7 @@ class FileTarget (AbstractFileTarget): # any more self.path_ = target_path - return self.path_ + return os.path.normpath(self.path_) class NotFileTarget(AbstractFileTarget): From 905a816239d8bdce0ebfda5ecc87dbce58aee685 Mon Sep 17 00:00:00 2001 From: Aaron Boman Date: Mon, 6 Oct 2014 12:35:10 -0500 Subject: [PATCH 5/9] check_init_parameters: requirement should be a container. --- src/tools/common.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/tools/common.py b/src/tools/common.py index 7a9348bf2..63c65e4c0 100644 --- a/src/tools/common.py +++ b/src/tools/common.py @@ -174,14 +174,17 @@ def check_init_parameters(toolset, requirement, *args): The return value from this rule is a condition to be used for flags settings. """ from b2.build import toolset as b2_toolset + if requirement is None: + requirement = [] # The type checking here is my best guess about # what the types should be. assert(isinstance(toolset, str)) - assert(isinstance(requirement, str) or requirement is None) + # iterable and not a string, allows for future support of sets + assert(not isinstance(requirement, basestring) and hasattr(requirement, '__contains__')) sig = toolset condition = replace_grist(toolset, '') subcondition = [] - + for arg in args: assert(isinstance(arg, tuple)) assert(len(arg) == 2) @@ -237,7 +240,7 @@ def check_init_parameters(toolset, requirement, *args): # if a requirement is specified, the signature should be unique # with that requirement if requirement: - sig += '-' + requirement + sig += '-' + '-'.join(requirement) if __all_signatures.has_key(sig): message = "duplicate initialization of '%s' with the following parameters: " % toolset @@ -259,7 +262,7 @@ def check_init_parameters(toolset, requirement, *args): # condition. To accomplish this we add a toolset requirement that imposes # the toolset subcondition, which encodes the version. if requirement: - r = ['' + toolset, requirement] + r = ['' + toolset] + requirement r = ','.join(r) b2_toolset.add_requirements([r + ':' + c for c in subcondition]) @@ -267,7 +270,7 @@ def check_init_parameters(toolset, requirement, *args): # variables and options to this specific version. condition = [condition] if requirement: - condition += [requirement] + condition += requirement if __show_configuration: print "notice:", condition From 0abdbd568ba37b26555ebdfb3a4c650aae53bf9a Mon Sep 17 00:00:00 2001 From: Aaron Boman Date: Mon, 6 Oct 2014 12:37:10 -0500 Subject: [PATCH 6/9] command is always a sequence, always use extend(). --- src/tools/msvc.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/tools/msvc.py b/src/tools/msvc.py index 7daadffd9..02dce9f9e 100644 --- a/src/tools/msvc.py +++ b/src/tools/msvc.py @@ -115,10 +115,7 @@ def init(version = None, command = None, options = None): command = to_seq(command) if command: - if isinstance(command, str): - options.append('' + command) - else: - options.extend(""+cmd for cmd in command) + options.extend(""+cmd for cmd in command) configure(version,options) def configure(version=None, options=None): From e246c739360f125ef5f3760e0d50409053436188 Mon Sep 17 00:00:00 2001 From: Aaron Boman Date: Mon, 6 Oct 2014 12:37:46 -0500 Subject: [PATCH 7/9] Old style exceptions don't work. --- src/tools/rc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/rc.py b/src/tools/rc.py index bacd3260a..d026480d8 100644 --- a/src/tools/rc.py +++ b/src/tools/rc.py @@ -27,6 +27,7 @@ import re import bjam from b2.build import type, toolset, generators, scanner, feature +from b2.exceptions import AlreadyDefined from b2.tools import builtin from b2.util import regex from b2.build.toolset import flags @@ -91,7 +92,7 @@ class RCAction: def rc_register_action(action_name, function = None): global engine if engine.actions.has_key(action_name): - raise "Bjam action %s is already defined" % action_name + raise AlreadyDefined("Bjam action %s is already defined" % action_name) engine.actions[action_name] = RCAction(action_name, function) def rc_compile_resource(targets, sources, properties): From 29273d767d840c371b99e210180a0f36c0c4ec2d Mon Sep 17 00:00:00 2001 From: Aaron Boman Date: Mon, 6 Oct 2014 12:38:42 -0500 Subject: [PATCH 8/9] Use __file__ variable for location. --- src/tools/testing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/testing.py b/src/tools/testing.py index 360f07aed..a3b3f0117 100644 --- a/src/tools/testing.py +++ b/src/tools/testing.py @@ -322,7 +322,7 @@ get_manager().engine().register_bjam_action("testing.capture-output", capture_output_setup) -path = os.path.dirname(get_manager().projects().loaded_tool_module_path_[__name__]) +path = os.path.dirname(__file__) import b2.util.os_j get_manager().projects().project_rules()._import_rule("testing", "os.name", b2.util.os_j.name) From 9e3147234d5e278db8bd859ac408e0e3ca995c97 Mon Sep 17 00:00:00 2001 From: Aaron Boman Date: Mon, 6 Oct 2014 13:16:51 -0500 Subject: [PATCH 9/9] Add module's location to loaded_tool_module_path_ dict. --- src/build/project.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/build/project.py b/src/build/project.py index 9e43fb185..71bc33fb3 100644 --- a/src/build/project.py +++ b/src/build/project.py @@ -707,6 +707,7 @@ actual value %s""" % (jamfile_module, saved_project, self.current_project)) __import__(mname) module = sys.modules[mname] self.loaded_tool_modules_[name] = module + self.loaded_tool_module_path_[mname] = module.__file__ return module self.manager.errors()("Cannot find module '%s'" % name)