aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-09-28 18:54:09 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2013-09-28 18:54:09 +0300
commit31b1c26fbdc707040e6e6dc4cad26dd76ca64038 (patch)
tree3abf4fb76869aa6dc8750739f4b243891f1ad194
parentc168d2c73a1eb467e1551be7d4279a8250f90f27 (diff)
downloadmeson-31b1c26fbdc707040e6e6dc4cad26dd76ca64038.zip
meson-31b1c26fbdc707040e6e6dc4cad26dd76ca64038.tar.gz
meson-31b1c26fbdc707040e6e6dc4cad26dd76ca64038.tar.bz2
More holder extraction.
-rw-r--r--build.py34
-rw-r--r--interpreter.py52
2 files changed, 51 insertions, 35 deletions
diff --git a/build.py b/build.py
index bbc3ac4..13ba257 100644
--- a/build.py
+++ b/build.py
@@ -414,3 +414,37 @@ class SharedLibrary(BuildTarget):
if self.version is not None:
aliases.append(self.get_shbase())
return aliases
+
+class ConfigureFile():
+
+ def __init__(self, subdir, sourcename, targetname, configuration_data):
+ self.subdir = subdir
+ self.sourcename = sourcename
+ self.targetname = targetname
+ self.configuration_data = configuration_data
+
+ def get_configuration_data(self):
+ return self.configuration_data
+
+ def get_sources(self):
+ return self.sources
+
+ def get_subdir(self):
+ return self.subdir
+
+ def get_source_name(self):
+ return self.sourcename
+
+ def get_target_name(self):
+ return self.targetname
+
+class ConfigurationData():
+ def __init__(self):
+ super().__init__()
+ self.values = {}
+
+ def get(self, name):
+ return self.values[name]
+
+ def keys(self):
+ return self.values.keys()
diff --git a/interpreter.py b/interpreter.py
index a902560..688b49b 100644
--- a/interpreter.py
+++ b/interpreter.py
@@ -100,11 +100,17 @@ class RunProcess(InterpreterObject):
def stderr_method(self, args, kwargs):
return self.stderr
-class ConfigurationData(InterpreterObject):
+class ConfigureFileHolder(InterpreterObject):
+
+ def __init__(self, subdir, sourcename, targetname, configuration_data):
+ InterpreterObject.__init__(self)
+ self.held_object = build.ConfigureFile(subdir, sourcename, targetname, configuration_data)
+
+class ConfigurationDataHolder(InterpreterObject):
def __init__(self):
super().__init__()
self.used = False # These objects become immutable after use in configure_file.
- self.values = {}
+ self.held_object = build.ConfigurationData()
self.methods.update({'set': self.set_method,
'set10': self.set10_method,
})
@@ -128,20 +134,20 @@ class ConfigurationData(InterpreterObject):
def set_method(self, args, kwargs):
(name, val) = self.validate_args(args)
- self.values[name] = val
+ self.held_object.values[name] = val
def set10_method(self, args, kwargs):
(name, val) = self.validate_args(args)
if val:
- self.values[name] = 1
+ self.held_object.values[name] = 1
else:
- self.values[name] = 0
+ self.held_object.values[name] = 0
def get(self, name):
- return self.values[name]
+ return self.held_object.values[name]
def keys(self):
- return self.values.keys()
+ return self.held_object.values.keys()
# Interpreter objects can not be pickled so we must have
# these wrappers.
@@ -291,30 +297,6 @@ class Data(InterpreterObject):
def get_sources(self):
return self.sources
-class ConfigureFile(InterpreterObject):
-
- def __init__(self, subdir, sourcename, targetname, configuration_data):
- InterpreterObject.__init__(self)
- self.subdir = subdir
- self.sourcename = sourcename
- self.targetname = targetname
- self.configuration_data = configuration_data
-
- def get_configuration_data(self):
- return self.configuration_data
-
- def get_sources(self):
- return self.sources
-
- def get_subdir(self):
- return self.subdir
-
- def get_source_name(self):
- return self.sourcename
-
- def get_target_name(self):
- return self.targetname
-
class Man(InterpreterObject):
def __init__(self, sources, kwargs):
@@ -708,7 +690,7 @@ class Interpreter():
def func_configuration_data(self, node, args, kwargs):
if len(args) != 0:
raise InterpreterException('configuration_data takes no arguments')
- return ConfigurationData()
+ return ConfigurationDataHolder()
def func_project(self, node, args, kwargs):
if len(args)< 2:
@@ -902,13 +884,13 @@ class Interpreter():
inputfile = kwargs['input']
output = kwargs['output']
conf = kwargs['configuration']
- if not isinstance(conf, ConfigurationData):
+ if not isinstance(conf, ConfigurationDataHolder):
raise InterpreterException('Argument "configuration" is not of type configuration_data')
conffile = os.path.join(self.subdir, inputfile)
self.build_def_files.append(conffile)
- c = ConfigureFile(self.subdir, inputfile, output, conf)
- self.build.configure_files.append(c)
+ c = ConfigureFileHolder(self.subdir, inputfile, output, conf.held_object)
+ self.build.configure_files.append(c.held_object)
conf.mark_used()
def func_include_directories(self, node, args, kwargs):