diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-10-16 22:33:33 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-10-16 22:33:33 +0300 |
commit | 309a5c1510810d3676dcec9962894a3353ce218c (patch) | |
tree | 60bff326cf68f7eb5c1422b5800bdbd30727bb4d /build.py | |
parent | 4e522ef2158c8ba4bac3f13b31ecd2f746696a84 (diff) | |
download | meson-309a5c1510810d3676dcec9962894a3353ce218c.zip meson-309a5c1510810d3676dcec9962894a3353ce218c.tar.gz meson-309a5c1510810d3676dcec9962894a3353ce218c.tar.bz2 |
Options can be accessed from scripts.
Diffstat (limited to 'build.py')
-rw-r--r-- | build.py | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -40,6 +40,16 @@ class Build: self.static_cross_linker = None self.configure_files = [] self.pot = [] + self.user_options = {} + + def merge_options(self, options): + for (name, value) in options.items(): + if name not in self.user_options: + self.user_options[name] = value + else: + oldval = self.user_options[name] + if type(oldval) != type(value): + self.user_options[name] = value def add_compiler(self, compiler): if len(self.compilers) == 0: @@ -82,7 +92,7 @@ class IncludeDirs(): # Fixme: check that the directories actually exist. # Also that they don't contain ".." or somesuch. if len(kwargs) > 0: - raise InvalidCode('Includedirs function does not take keyword arguments.') + raise InvalidArguments('Includedirs function does not take keyword arguments.') def get_curdir(self): return self.curdir @@ -268,15 +278,15 @@ class BuildTarget(): if len(pchlist) == 2: if environment.is_header(pchlist[0]): if not environment.is_source(pchlist[1]): - raise InterpreterException('PCH definition must contain one header and at most one source.') + raise InvalidArguments('PCH definition must contain one header and at most one source.') elif environment.is_source(pchlist[0]): if not environment.is_header(pchlist[1]): - raise InterpreterException('PCH definition must contain one header and at most one source.') + raise InvalidArguments('PCH definition must contain one header and at most one source.') pchlist = [pchlist[1], pchlist[0]] else: - raise InterpreterException('PCH argument %s is of unknown type.' % pchlist[0]) + raise InvalidArguments('PCH argument %s is of unknown type.' % pchlist[0]) elif len(pchlist) > 2: - raise InterpreterException('PCH definition may have a maximum of 2 files.') + raise InvalidArguments('PCH definition may have a maximum of 2 files.') self.pch[language] = pchlist def add_include_dirs(self, args): |