# HG changeset patch # User osimons # Date 1305583047 0 # Node ID 0cf576cea845c33f5a4a13cc39f7a382b3994935 # Parent 2c82cf261d9ee0fe28b65721a411c4578fa49c1b Make platform rules matching case-insensitive. Fixes #334. Patch with test by Anatoly Techtonik. Thanks! diff --git a/bitten/queue.py b/bitten/queue.py --- a/bitten/queue.py +++ b/bitten/queue.py @@ -184,7 +184,8 @@ for propname, pattern in ifilter(None, platform.rules): try: propvalue = properties.get(propname) - if not propvalue or not re.match(pattern, propvalue): + if not propvalue or not re.match(pattern, + propvalue, re.I): match = False break except re.error: diff --git a/bitten/tests/queue.py b/bitten/tests/queue.py --- a/bitten/tests/queue.py +++ b/bitten/tests/queue.py @@ -450,6 +450,18 @@ platforms = queue.match_slave('foo', {'family': 'nt'}) self.assertEqual([], platforms) + def test_register_slave_match_case_insensitive(self): + BuildConfig(self.env, 'test', active=True).insert() + platform = TargetPlatform(self.env, config='test', name="Unix") + platform.rules.append(('os', 'LiNUX')) + platform.insert() + platform_id = platform.id + + queue = BuildQueue(self.env) + platforms = queue.match_slave('foo', {'os': 'linux'}) + self.assertEqual(1, len(platforms)) + self.assertEqual(platform_id, platforms[0].id) + def test_register_slave_match_regexp(self): BuildConfig(self.env, 'test', active=True).insert() platform = TargetPlatform(self.env, config='test', name="Unix")