summaryrefslogtreecommitdiffstats
path: root/pym/portage/sets/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/portage/sets/__init__.py')
-rw-r--r--pym/portage/sets/__init__.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py
index 5f82b69b7..39cebdf84 100644
--- a/pym/portage/sets/__init__.py
+++ b/pym/portage/sets/__init__.py
@@ -9,6 +9,16 @@ from portage.const import USER_CONFIG_PATH, GLOBAL_CONFIG_PATH
SETPREFIX = "@"
+def get_boolean(options, name, default):
+ if not name in options:
+ return default
+ elif options[name].lower() in ("1", "yes", "on", "true"):
+ return True
+ elif options[name].lower() in ("0", "no", "off", "false"):
+ return False
+ else:
+ raise SetConfigError("invalid value '%s' for option '%s'" % (options[name], name))
+
class SetConfigError(Exception):
pass