From 6950d8373e9863b50dcd649879fc77b5309dfb80 Mon Sep 17 00:00:00 2001 From: Juraj Ivancic Date: Fri, 2 Dec 2011 15:59:20 +0100 Subject: [PATCH] Fix syntax errors in rc.py and midl.py. --- src/tools/midl.py | 14 +++++++------- src/tools/rc.py | 20 +++++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/tools/midl.py b/src/tools/midl.py index 45811d16b..43bcdf6fe 100644 --- a/src/tools/midl.py +++ b/src/tools/midl.py @@ -11,7 +11,7 @@ from b2.build.toolset import flags from b2.build.feature import feature from b2.manager import get_manager from b2.tools import builtin, common -from b2.util import regex +from b2.util import regex, utility def init(): pass @@ -52,8 +52,8 @@ class MidlScanner(scanner.Scanner): imported_tlbs = regex.transform(matches, self.re_importlib, [1, 3]) # CONSIDER: the new scoping rule seem to defeat "on target" variables. - g = bjam.call('get-target-variable', target, 'HDRGRIST') - b = os.path.normalize_path(os.path.dirname(binding)) + g = bjam.call('get-target-variable', target, 'HDRGRIST')[0] + b = os.path.normpath(os.path.dirname(binding)) # Attach binding of including file to included targets. # When target is directly created from virtual target @@ -75,10 +75,10 @@ class MidlScanner(scanner.Scanner): bjam.call('INCLUDES', [target], all) bjam.call('DEPENDS', [target], imported_tlbs) bjam.call('NOCARE', all + imported_tlbs) - engine.set_target_variable(included_angle , 'SEARCH', ungrist(self.includes)) - engine.set_target_variable(included_quoted, 'SEARCH', b + ungrist(self.includes)) - engine.set_target_variable(imported , 'SEARCH', b + ungrist(self.includes)) - engine.set_target_variable(imported_tlbs , 'SEARCH', b + ungrist(self.includes)) + engine.set_target_variable(included_angle , 'SEARCH', [utility.get_value(inc) for inc in self.includes]) + engine.set_target_variable(included_quoted, 'SEARCH', [utility.get_value(inc) for inc in self.includes]) + engine.set_target_variable(imported , 'SEARCH', [utility.get_value(inc) for inc in self.includes]) + engine.set_target_variable(imported_tlbs , 'SEARCH', [utility.get_value(inc) for inc in self.includes]) get_manager().scanners().propagate(type.get_scanner('CPP', PropertySet(self.includes)), included_angle + included_quoted) get_manager().scanners().propagate(self, imported) diff --git a/src/tools/rc.py b/src/tools/rc.py index 0b82d231d..bacd3260a 100644 --- a/src/tools/rc.py +++ b/src/tools/rc.py @@ -21,11 +21,17 @@ ##import scanner ; ##import toolset : flags ; +import os.path +import re + +import bjam + from b2.build import type, toolset, generators, scanner, feature from b2.tools import builtin from b2.util import regex from b2.build.toolset import flags from b2.manager import get_manager +from b2.util import utility __debug = None @@ -135,7 +141,7 @@ class ResScanner(scanner.Scanner): "[ ]+([^ \"]+|\"[^\"]+\"))|(#include[ ]*(<[^<]+>|\"[^\"]+\")))" ; def process(self, target, matches, binding): - + binding = binding[0] angle = regex.transform(matches, "#include[ ]*<([^<]+)>") quoted = regex.transform(matches, "#include[ ]*\"([^\"]+)\"") res = regex.transform(matches, @@ -147,11 +153,11 @@ class ResScanner(scanner.Scanner): # IDR_MAINFRAME ICON "res\\icon.ico" # # so we have to replace double backslashes to single ones. - res = [ re.sub(r'\\\\', '/', match) for match in res ] + res = [ re.sub(r'\\\\', '/', match) for match in res if match is not None ] # CONSIDER: the new scoping rule seem to defeat "on target" variables. - g = bjam.call('get-target-variable', target, 'HDRGRIST') - b = os.path.normalize_path(os.path.dirname(binding)) + g = bjam.call('get-target-variable', target, 'HDRGRIST')[0] + b = os.path.normpath(os.path.dirname(binding)) # Attach binding of including file to included targets. # When target is directly created from virtual target @@ -177,9 +183,9 @@ class ResScanner(scanner.Scanner): engine.add_dependency(target, res) bjam.call('NOCARE', all + res) - engine.set_target_variable(angle, 'SEARCH', ungrist(self.includes)) - engine.set_target_variable(quoted, 'SEARCH', b + ungrist(self.includes)) - engine.set_target_variable(res, 'SEARCH', b + ungrist(self.includes)) ; + engine.set_target_variable(angle, 'SEARCH', [utility.get_value(inc) for inc in self.includes]) + engine.set_target_variable(quoted, 'SEARCH', [b + utility.get_value(inc) for inc in self.includes]) + engine.set_target_variable(res, 'SEARCH', [b + utility.get_value(inc) for inc in self.includes]) # Just propagate current scanner to includes, in a hope # that includes do not change scanners.