summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2014-01-27 13:41:38 +0100
committerAndoni Morales Alastruey <ylatuya@gmail.com>2014-01-30 12:31:56 +0100
commit0093d0b7be81435ae705742033a5362437373bcb (patch)
tree7cbf4bd5017fef6dbc1d93d0ff97461c496cc9ee
parentfc7ed78f0fb74664c4c07687cba211b67af2d452 (diff)
variants: support 'no' modifier for variants
Use positive variants and allow a 'no' modifier for them
-rw-r--r--cerbero/config.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/cerbero/config.py b/cerbero/config.py
index e9f7ee8b..ac6873b7 100644
--- a/cerbero/config.py
+++ b/cerbero/config.py
@@ -48,18 +48,26 @@ License = enums.License
class Variants(object):
- __variants = ['nodebug']
+ __enabled_variants = ['debug']
def __init__(self, variants):
- for v in self.__variants:
+ for v in self.__enabled_variants:
+ setattr(self, v, True)
+ for v in self.__disabled_variants:
setattr(self, v, False)
for v in variants:
- setattr(self, v, True)
+ if v.startswith('no'):
+ setattr(self, v[2:], False)
+ else:
+ setattr(self, v, True)
def __getattr__(self, name):
try:
- return object.__getattr__(name)
- except:
+ if name.startswith('no'):
+ return not object.__getattribute__(self, name[2:])
+ else:
+ return object.__getattribute__(self, name)
+ except Exception:
raise AttributeError("%s is not a known variant" % name)
@@ -104,9 +112,6 @@ class Config (object):
# from the main configuration file
self._load_cmd_config(filename)
- # Build variants before copying any config
- self.variants = Variants(self.variants)
-
# Create a copy of the config for each architecture in case we are
# building Universal binaries
if self.target_arch == Architecture.UNIVERSAL:
@@ -136,6 +141,11 @@ class Config (object):
config._validate_properties()
config._raw_environ = os.environ.copy()
+ # Build variants before copying any config
+ self.variants = Variants(self.variants)
+ for c in self.arch_config.values():
+ c.variants = self.variants
+
self.do_setup_env()
# Store current os.environ data