diff options
author | Steven Knight <knight@baldmt.com> | 2003-12-06 16:56:06 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-12-06 16:56:06 (GMT) |
commit | 51df374228f9684ec84bebac6e3cc171b2b5f4e6 (patch) | |
tree | 9297bb6fada769e9b3d4167d311ed35d06453baf /src/engine/SCons | |
parent | 57f48b51a0afb14f5942564990475a443b799964 (diff) | |
download | SCons-51df374228f9684ec84bebac6e3cc171b2b5f4e6.zip SCons-51df374228f9684ec84bebac6e3cc171b2b5f4e6.tar.gz SCons-51df374228f9684ec84bebac6e3cc171b2b5f4e6.tar.bz2 |
Fix saving/restoring PackageOptions to a file. (Chris Burghart)
Diffstat (limited to 'src/engine/SCons')
-rw-r--r-- | src/engine/SCons/Options/PackageOption.py | 6 | ||||
-rw-r--r-- | src/engine/SCons/Options/PackageOptionTests.py | 10 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/engine/SCons/Options/PackageOption.py b/src/engine/SCons/Options/PackageOption.py index 5940974..9ecb42a 100644 --- a/src/engine/SCons/Options/PackageOption.py +++ b/src/engine/SCons/Options/PackageOption.py @@ -1,4 +1,4 @@ -"""engine.SCons.Options +"""engine.SCons.Options.PackageOption This file defines the option type for SCons implementing 'package activation'. @@ -59,8 +59,8 @@ import string from BoolOption import True, False import SCons.Errors -__enable_strings = ('yes', 'true', 'on', 'enable', 'search') -__disable_strings = ('no', 'false', 'off', 'disable') +__enable_strings = (str(True), 'yes', 'true', 'on', 'enable', 'search') +__disable_strings = (str(False), 'no', 'false', 'off', 'disable') def _converter(val): """ diff --git a/src/engine/SCons/Options/PackageOptionTests.py b/src/engine/SCons/Options/PackageOptionTests.py index d9fbe7b..7c868e5 100644 --- a/src/engine/SCons/Options/PackageOptionTests.py +++ b/src/engine/SCons/Options/PackageOptionTests.py @@ -28,6 +28,7 @@ import unittest import SCons.Errors import SCons.Options +from SCons.Options.BoolOption import True, False import TestCmd @@ -76,6 +77,15 @@ class PackageOptionTestCase(unittest.TestCase): x = o.converter('/explicit/path') assert x == '/explicit/path', x + # Make sure the converter returns True if we give it str(True) and + # False when we give it str(False). This assures consistent operation + # through a cycle of Options.Save(<file>) -> Options(<file>). + x = o.converter(str(True)) + assert x == True, "converter returned a string when given str(True)" + + x = o.converter(str(False)) + assert x == False, "converter returned a string when given str(False)" + def test_validator(self): """Test the PackageOption validator""" opts = SCons.Options.Options() |