diff options
Diffstat (limited to 'tools/buildman/toolchain.py')
-rw-r--r-- | tools/buildman/toolchain.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 086a4d47cd..4f39bfd0ce 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -18,6 +18,8 @@ import tools (PRIORITY_FULL_PREFIX, PRIORITY_PREFIX_GCC, PRIORITY_PREFIX_GCC_PATH, PRIORITY_CALC) = list(range(4)) +(VAR_CROSS_COMPILE, VAR_PATH, VAR_ARCH, VAR_MAKE_ARGS) = range(4) + # Simple class to collect links from a page class MyHTMLParser(HTMLParser): def __init__(self, arch): @@ -145,6 +147,30 @@ class Toolchain: return value + def GetEnvArgs(self, which): + """Get an environment variable/args value based on the the toolchain + + Args: + which: VAR_... value to get + + Returns: + Value of that environment variable or arguments + """ + wrapper = self.GetWrapper() + if which == VAR_CROSS_COMPILE: + return wrapper + os.path.join(self.path, self.cross) + elif which == VAR_PATH: + return self.path + elif which == VAR_ARCH: + return self.arch + elif which == VAR_MAKE_ARGS: + args = self.MakeArgs() + if args: + return ' '.join(args) + return '' + else: + raise ValueError('Unknown arg to GetEnvArgs (%d)' % which) + def MakeEnvironment(self, full_path): """Returns an environment for using the toolchain. |