summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-12-06 16:56:06 (GMT)
committerSteven Knight <knight@baldmt.com>2003-12-06 16:56:06 (GMT)
commit51df374228f9684ec84bebac6e3cc171b2b5f4e6 (patch)
tree9297bb6fada769e9b3d4167d311ed35d06453baf /src/engine/SCons
parent57f48b51a0afb14f5942564990475a443b799964 (diff)
downloadSCons-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.py6
-rw-r--r--src/engine/SCons/Options/PackageOptionTests.py10
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()